|
CBenac wrote: Would it be possible to show an example on how to call it from the client side?
Not without seeing the generated client-side interface code.
CBenac wrote: Now, in another issue, why the code in my SL3 is generated different from the one in your example? There is no interface as you can see.
The lack of an interface is probably why it doesn't work.
WCF requires an interface to define the contract.
Maybe try something like this (make sure your service endpoint contract specifies yournamespace.IService1):
[ServiceContract(Namespace = "")]
public interface IService1
{
[OperationContract]
public string SetList(List<People> people);
}
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1
{
public string SetList(List<People> people)
{
return "OK";
}
}
public class People
{
public string Name;
public int Age;
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark,
OK I'll implement the interface but why silverlight doesn't do it automatically when the service is created? Also, the other services are working fine without the interface implementation.
|
|
|
|
|
CBenac wrote: the other services are working fine without the interface implementation
I just know when you use the interface, the client side code is generated
correctly and automatically.
If it works without the interface, go for it.
But then you may not even be using automatically generated code on
the client, I don't know...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have the following code that is suposed to loop through a number of images but sends out a blank page for the first images and only displays the last one in the list.
namespace WpfApplication5
{
public partial class App : System.Windows.Application
{
void OnStartup(Object sender, StartupEventArgs e)
{
Window1 primaryWindow = new Window1();
primaryWindow.WindowStartupLocation = WindowStartupLocation.Manual;
System.Drawing.Rectangle location = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
primaryWindow.WindowState = WindowState.Maximized;
string Path = Environment.CurrentDirectory + "\\images";
foreach (System.Windows.Forms.Screen screen in System.Windows.Forms.Screen.AllScreens)
{
if (screen == System.Windows.Forms.Screen.PrimaryScreen)
{
Window1 window = new Window1();
window.Photos = (PhotoCollection)(this.Resources["Photos"] as ObjectDataProvider).Data;
window.Photos.Path = Environment.CurrentDirectory + "\\Images";
for (int i = 0; i < window.Photos.Count; ++i)
{
window.WindowStartupLocation = WindowStartupLocation.Manual;
location = screen.Bounds;
window.Left = location.X - 7;
window.Top = location.Y - 7;
window.Width = location.Width + 14;
window.Height = location.Height + 14;
if (i > 0)
System.Threading.Thread.Sleep(40);
window.ScreenSaver(window.Photos[i].Source);
window.Show();
}
}
}
}
}
}
public partial class Window1 : System.Windows.Window
{
public PhotoCollection Photos;
public Window1()
{
InitializeComponent();
}
void OnLoaded(object sender, EventArgs e)
{
TypeConverter colorTypeConverter = TypeDescriptor.GetConverter(typeof(Color));
Background = new SolidColorBrush((Color)colorTypeConverter.ConvertFrom(Properties.Settings.Default.BackgroundColor));
}
public void ScreenSaver(string imagepath)
{
StackPanel mainPanel = new StackPanel();
Window1 window = new Window1();
ImageBrush picturebrush = new ImageBrush();
picturebrush.ImageSource =
new BitmapImage(
new Uri(imagepath, UriKind.Relative)
);
Canvas myCanvas = new Canvas();
System.Drawing.Rectangle location = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
window.Left = location.X - 7;
window.Top = location.Y - 7;
myCanvas.Width = location.Width + 14;
myCanvas.Height = location.Height + 14;
myCanvas.Background = picturebrush;
mainPanel.Children.Add(myCanvas);
this.Content = mainPanel;
modified on Tuesday, October 6, 2009 10:11 AM
|
|
|
|
|
Please post your question once only. Also it would be helpful if you put your code between <pre></pre> tags so it is correctly formatted and readable. See the posting guidelines here[^].
|
|
|
|
|
havegunwilltravel wrote: System.Threading.Thread.Sleep(40);
40 THOUSANDTHS of a second ? You need to rethink all of this. A better option would be to use a timer, not to make the thread sleep when it should be updating a photo.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I have the following code that is suposed to loop through a number of images but sends out a blank page for the first images and only displays the last one in the list.
namespace WpfApplication5
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : System.Windows.Application
{
void OnStartup(Object sender, StartupEventArgs e)
{
//creates window on primary screen
Window1 primaryWindow = new Window1();
primaryWindow.WindowStartupLocation = WindowStartupLocation.Manual;
System.Drawing.Rectangle location = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
primaryWindow.WindowState = WindowState.Maximized;
string Path = Environment.CurrentDirectory + "\\images";
//creates window on other screens
foreach (System.Windows.Forms.Screen screen in System.Windows.Forms.Screen.AllScreens)
{
if (screen == System.Windows.Forms.Screen.PrimaryScreen)
{
Window1 window = new Window1();
window.Photos = (PhotoCollection)(this.Resources["Photos"] as ObjectDataProvider).Data;
window.Photos.Path = Environment.CurrentDirectory + "\\Images";
for (int i = 0; i < window.Photos.Count; ++i)
{
window.WindowStartupLocation = WindowStartupLocation.Manual;
location = screen.Bounds;
//covers entire monitor
window.Left = location.X - 7;
window.Top = location.Y - 7;
window.Width = location.Width + 14;
window.Height = location.Height + 14;
if (i > 0)
System.Threading.Thread.Sleep(40);
window.ScreenSaver(window.Photos[i].Source);
window.Show();
}
}
}
}
}
}
|
|
|
|
|
I have a datagrid being populated from a datatable which contains several computed columns. If the computed cell value is >= to the previous day's value, I want the font color to stay the same. If the value is < than the previous day's value, I want to change the font for that particular cell red (not the entire row). Is that possible? In the WinForm datagridview it wasn't a big deal.
I'm new to WPF and the datagrid, but am I missing something simple here to accomplish the same task?
Thanks for any pointers or help.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
You should easily be able to accomplish this via DataTriggers.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Roger that gold leader. Let me go looking into datatriggers.
Thanks!
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hi to all:
Please could someone help me!
I am new to Silverlight but trying to get my head around the format and structure of it all.
I am experimenting with different ways of designing a web site and encountered the following problem.
What I am trying to do in a nutshell is to host a Silverlight control from a Silverlight application. To be more specific; from a *.Xaml file. My example is below:-
I am using a third party Silverlight control called Vertigo.Slideshow (I'm sure you will have heard of it).
From a website (Html coded page) I just do the following
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Gallery</title>
<script type="text/javascript" src="../Scripts/Release/Silverlight.js"></script>
<script type="text/javascript" src="../Scripts/Release/SlideShow.js"></script>
</head>
<body>
<div id="content_container">
<script type="text/javascript">
new SlideShow.Control(new SlideShow.XmlConfigProvider());
</script>
</div>
</body>
I then just add a Data.Xml file (with refs to all images) and also a Configuration.Xml to my current folder. This all works perfectly fine.
However, I've created a new web site in Visual Studio 2008 using 'Silverlight Navigation Application'.
So all my web pages are in the *.Xaml format.
What I'm trying to do is add this Vertigo.Slideshow.Xap control to my web page (Xaml) but really, really struggling. I know I must be doing something fundamentally wrong but cannot seem to resolve it.
I would really appreciate any help whatsoever to anyone who can shed some light on this (or even a snippet of code which will do this).
I would be eternally grateful to whomever gives me a pointer.
Thanks in advance.
Regards
Richard 
|
|
|
|
|
Richard Hudson wrote: I am using a third party Silverlight control called Vertigo.Slideshow (I'm sure you will have heard of it)
hmm bold assumption. Some of us don't use third party controls...
I would look first into the control documentation.
If it's a Silverlight control then there should be a way to package
the control's assemblies into your Silverlight app's XAP file and you should be
able to use the control in your app like any other control.
If it's just a plugin control for web pages then you may have some issues.
While it's relatively simple to dynamically download a XAP file and extract items from
it, you'd need to know the assemblies involved and the classes to use.
From a quick search on "Vertigo Slideshow", it looks like it's the latter - a plugin for
web pages, not a Silverlight control. The source code is available though...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark for your time.
I've sort of found a solution.
Thanks again for your time.
Regards
Rich
|
|
|
|
|
Hi there
Can anyone perhaps tell me how to specify, in XAML, a path to an image that is not added as a resource, but instead in an "Icons" folder within the "Bin" folder?
For instance, I've got a button, and I want to display an icon on this button. This is easy when adding the icon files as resources (Right-click >> Add Existing Item) because I can then simply set the Source property to a specific icon file that I added, but I need to do this the other way because when creating a Setup project all files used by my application needs to be in the folder relative to where the EXE is, which is the Bin folder
Thanks in advance
|
|
|
|
|
You can find the StartupPath if you follow the directions in my post here[^]. You could then do something like the following:
private void AssignImage(string fileName)
{
string path = Path.Combine(Utility.StartupPath, "Icons");
string file = Path.Combine(path, fileName);
myImage.BeginInit();
myImage.Source = new BitmapImage(file);
myImage.EndInit();
}
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thanks, this might work. But I'd have to go and do this for each and every one of my icons that I use, which is quite a lot. Isn't there an easy way to just specify the icon path in the XAML? I tried using Pack URI's but I had no luck
|
|
|
|
|
There's no reason you couldn't convert this logic into an attached property and attach it that way.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
The main reason I want to do this is because I want to move my Icons folder to the Bin folder. All icons I use are stored in this folder. I want to move it to the Bin folder because this makes things easier when creating a setup project, and I don't know of any other way. So how would one normally go about creating a Setup project for an application that uses icons? Almost all apps use them, and don't tell me all developers have to follow this approach that you're telling me to take now?
|
|
|
|
|
Why aren't you applying them as resources then? These are embedded in the exe, so don't need to be added to your setup project. I don't see what benefit you've got keeping them external to the application.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Well that's what I'm doing, but for some or other reason my app crashes when I install and run it. It runs fine when I take out all the icons, that's why I thought it might be the icons' path. Can it be something else then?
|
|
|
|
|
Without seeing what you're doing with the images, it's hard to say. I use inline images regularly with no problems - what format are they, and why not try creating an app with one of your images in? Install the app, and see if it crashes - it may be that there is a problem with just one of these images, and I'd isolate the problem first.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I specified my resources wrong, that's why it wasn't embedded in the exe. I typed in the path manually e.g. Source="Icons/icon.ico" instead of choosing them from the list in the properties pane. When choosing an icon/image from this list the Source changes to /SolutionName;component/Icons/icon.ico , and this works perfectly
|
|
|
|
|
Hi... I am working on project fee and student management in college and require documentation and source code in WPF.Pls reply soon .
|
|
|
|
|
tina sharma wrote: I am working on project fee and student management in college and require documentation and source code in WPF.
Don't hold your breath 
|
|
|
|
|
tina sharma wrote: I am working
tina sharma wrote: and require documentation and source code
'I am working' and 'give me source code' are mutually exclusive. Did you mean to say 'I am lazy and require source code ' ?
Tell your teacher you're not capable of completing this course so you stop wasting his time and everyone elses.
They teach WPF in colleges now ? That's bizarre.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|