|
Johnny J. wrote: But isn't it so (with reference to your example) that the Customer class with
its DataContract attributes needs to be defined and have identical definitions
on both sides of the WCF wall?
Yes, but when you import the service reference, that comes with it. In other words, the proxy implementation that your Silverlight service calls is created for you - that's cool.
|
|
|
|
|
So when you change somthing in your service, you need to refresh or delete/readd your service reference?
Beidh ceol, caint agus craic againn - Seán Bán Breathnach ----- Don't tell my folks I'm a computer programmer - They think I'm a piano player in a cat house... ----- Da mihi sis crustum Etruscum cum omnibus in eo! ----- Everybody is ignorant, only on different subjects - Will Rogers, 1924
|
|
|
|
|
Yes. You import the contract, which creates a proxy implementation.
|
|
|
|
|
You need to pay Pete with a 5, thats an excellent explanation. Once you get over the initial STEEP learning curve it does make some sense. I got lucky, a corporate policy that the desktop is not allowed to connect directly to a database forced us to WCF and the move to SL was a natural from there.
I create the WCF in a separate project, the bulk of it can be built by a code generator as the CRUD operations (model and DAL/controller) are very standard.
The only real drawback that I have found is that a WCF does not allow a dynamic structure. Think of query a procedure an then just throw the result at a datagirdview in winforms, this is not the way SL/WPF works, EVERY thing needs to be defined, all the properties for the proc need to be in a model and that needs to be imported into the client and then you can use it in a datagrid. There is a work around for the dynamic stuff but it is painful.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You can have a 5 both of you. Thanks a lot for the help. Right now, it does look like gibberish to me. I hope that when I get the book, things will brighten a bit...
Why can't I be applicable like John? - Me, April 2011 ----- Beidh ceol, caint agus craic againn - Seán Bán Breathnach ----- Da mihi sis crustum Etruscum cum omnibus in eo! ----- Everybody is ignorant, only on different subjects - Will Rogers, 1924
|
|
|
|
|
Mycroft Holmes wrote: WCF does not allow a dynamic structure
Excellent point. You're right that you can get round it, but the effort of doing so doesn't justify the development needed to do it. I've been playing around with parsing dynamic ODATA structures, and it's just so much boilerplate and jiggery pokery that I'm seriously wishing I hadn't started it.
|
|
|
|
|
I use a structure from Telerik, return the data as xml to the client then parse it into the table/colum/row collections, this then dinds to the Telerik datagrid and I have a data dump utility from any stored proc.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
how to read the data from databinding list and display the data in a proper control(for ex: textbox)
wat i want to do here is, when user click on the listbox(lbDirectiveList) i want to display the selected DirectiveName in txtfilter.text and DirectiveDescription in txtdesc.text..
so can u tell me how to do it...
modified on Monday, April 18, 2011 3:01 AM
|
|
|
|
|
Do this :
void lbDirectiveList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Directive dire = (Directive)lbDirectiveList.SelectedItem;
txtfilter.text = dire.DirectiveName;
txtdesc.text = dire.Description;
}
People with high attitude deserve the standing ovation of our highest finger!
My Blog![ ^]
|
|
|
|
|
i have multiple Shapes in Canvas i want to move it together
i have tried some code but i have problems
first try
for (int i = 0; i < this.Children.Count; ++i)
{
double xOffset;
double yOffset;
double shapeTop = Canvas.GetTop(this.Children[i]);
double shapeLeft = Canvas.GetLeft(this.Children[i]);
xOffset = Convert.ToDouble(dropPoint.X -shapeClickPoint.Value.X);
yOffset = Convert.ToDouble(dropPoint.Y - shapeClickPoint.Value.Y);
TranslateTransform translateTransform = new TranslateTransform(xOffset, yOffset);
if (this.Children[i].IsEnabled)
{
this.Children[i].RenderTransform = translateTransform;
}
the problem when i translate the shapes returns to its position before translation
second try
for (int i = 0; i < this.Children.Count; ++i)
{
double shapeTop = Canvas.GetTop(this.Children[i]);
double shapeLeft = Canvas.GetLeft(this.Children[i]);
if (this.Children[i].IsEnabled)
{
Canvas.SetLeft(this.Children[i], -shapeLeft+ dropPoint.X - shapeClickPoint.Value.X);
Canvas.SetTop(this.Children[i], -shapeTop + dropPoint.Y - shapeClickPoint.Value.Y);
}
in second try the shapes toggle between mouse position and another position
how can i solve the issues
thank you
|
|
|
|
|
Why don't you use WPF animations? Thats what they are there for 
|
|
|
|
|
i found the solution in article in codeproject
thank you and i'm sorry not to search first
|
|
|
|
|
Hello,
I have WPF application. I use this code with different messages (SetMessage method) throughout the application:
infoMessageDlg = new InfoMessage();
infoMessageDlg.SetMessage("Записи не найдены...");
infoMessageDlg.Show();
timer.Interval = TimeSpan.FromMilliseconds(800);
timer.Start();
The timer I use is this:
private DispatcherTimer timer = null;
InfoMessage infoMessageDlg = null;
public MainWindow()
{
...
timer = new DispatcherTimer();
timer.Tick += new EventHandler(timer_Task);
}
It means dialog box appears for 800 milliseconds to display some message and closes automatically using this code:
private void timer_Task(object sender, EventArgs e)
{
infoMessageDlg.Close();
timer.Stop();
}
It works fine everywhere except in case I click listview item. The listview is bound to some data through its ItemsSource property. What happens? The dialog appears for very short time (almost not noticeable) and closes. It's much more shorter than 800 milliseconds.
The code looks like this:
private void lstvTestRuns_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
...
listTestLogs.ItemsSource = null;
listTestLogs.ItemsSource = lstTestLogs;
if (treeAdditionalInfo.Items.Count == 0 && listTestLogs.Items.Count == 0)
{
infoMessageDlg = new InfoMessage();
infoMessageDlg.SetMessage("Записи не найдены...");
infoMessageDlg.Show();
timer.Interval = TimeSpan.FromMilliseconds(800);
timer.Start();
}
...
}
Does anybody know what's going on here?
Thank you in advance for help.
modified on Thursday, April 14, 2011 1:53 AM
|
|
|
|
|
Hi
If virtualizingstackpanel provides better performance, should we then always choose virtualizingstackpanel over Grid/StackPanel then?
Under what circumstances should one choose Grid/StackPanel?
Thanks
dev
|
|
|
|
|
Actually VirtualizingStackPanel is mainly used to set the ItemsPanelTemplate for lets take an example for a ListBox where large data like 1000 or maybe 10,000 items or more have to be loaded into it.
You set it like this :
<ListBox Name="myListBox">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation = "Vertical"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
It means that you are setting the Panel for the ListBox so that "All" the items in ListBox can be arranged in a Vertical manner. Virtualization means that items will be created only when they are visible.
But if you substitute the VirtualizingStackPanel with a StackPanel , then performance will suffer heavily and your application will freeze for large amount of data.
If you think of normal circumstances like arranging two or three controls of your window like this :
<StackPanel Orientation="Horizontal">
<TextBox Text="Hello"/>
<ComboBox Name="cmbItems"/>
</StackPanel>
Then there is no point in using a VirtualizingStackPanel here as there are only 2 controls and there will be no performance enhancement at all. You can replace the StackPanel with a Grid or Canvas too.
You can also think of setting the DataTemplate for the ListBox like this :
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Item}"/>
<TextBlock Text="{Binding Path=AnotherItem}"/>
</DataTemplate>
</ListBox.ItemTemplate>
Again if you replace it with a VirtualizingStackPanel , it will not have any effect. You can as said above use Grid here too.
Its the ItemsPanelTemplate that you set matters.
So the point is for large amount of data, VirtualizingStackPanel is the correct choice and its by default used in ListBox , ListView and TreeView .
But using VirtualizingStackPanel also has some limitations. You cannot use Grouping and you have set the CanContentScroll of the ScrollViewer to True or else Virtualization will be switched off.
So it also depends on the requirement too. If you want to use Grouping, there is no point in using VirtualizingStackPanel .
Hope I was able to clear your doubt.
People with high attitude deserve the standing ovation of our highest finger!
My Blog![ ^]
modified on Friday, April 15, 2011 3:16 AM
|
|
|
|
|
Tarun.K.S wrote: Actually VirtualizingStackPanel is mainly used to set the
ItemsPanelTemplate for lets take an example for a
ListBox <br /> where large data like 10,000 items or more have to be loaded into it.
This is a bit misleading. You do not need 10,000 items to see the benefits of VirtualizingStackPanel. Even with 200 items you will see a huge difference. If you have a ListView control with 200 items and turn OFF virtualization, your app will consume about an extra 40MB of RAM. Ask me how I know .
|
|
|
|
|
SledgeHammer01 wrote: Even with 200 items you will see a huge difference.
Really? Might not be that huge.
SledgeHammer01 wrote: Ask me how I know
Yeah I would like to know!
People with high attitude deserve the standing ovation of our highest finger!
My Blog![ ^]
|
|
|
|
|
Are you using Visual Studio 2010? If so, may I recommend debugging the difference between the two with Mole 2010 (I've linked to it in my sig)? You'll find it very enlightening here.
|
|
|
|
|
Sorry Pete I actually use VS 2008. But I will try it for sure once I get my hands on VS 2010.
If I am not wrong, Josh Smith is its founder.
People with high attitude deserve the standing ovation of our highest finger!
My Blog![ ^]
|
|
|
|
|
You aren't wrong. Josh is one of the founders, which is why I use it. Another reason is that one of the Visual Studio Cider team also helps to develop it - it's got that inside edge which I like.
|
|
|
|
|
Wow that's cool.
People with high attitude deserve the standing ovation of our highest finger!
My Blog![ ^]
|
|
|
|
|
I saw 200 items add about 50MB of memory when I turned virtualization off. Thats how I know . You can turn virtualization off on the ListView. Those 200 items were nothing more then a simple TestItem with 3 CLR properties. If you've ever looked at all the parts of a ListView template (the list view itself, the scroll view, the list view item, etc), they all use a lot of visuals.
10 - 20 items realized vs. 200 items realized is a HUGE memory difference. Unless 50MB isn't considered "huge" .
|
|
|
|
|
SledgeHammer01 wrote: I saw 200 items add about 50MB of memory when I turned virtualization off. Thats how I know
Lol that was straightforward!
SledgeHammer01 wrote: 10 - 20 items realized vs. 200 items realized is a HUGE memory difference. Unless 50MB isn't considered "huge"
Heh! I don't think 50Mb is that HUGE!
But yes I got your point.
People with high attitude deserve the standing ovation of our highest finger!
My Blog![ ^]
|
|
|
|
|
Tarun.K.S wrote:
Heh! I don't think 50Mb is that HUGE!
*Sigh*... kids today... . *One control* using an extra 50MB is "no big deal". No wonder apps are such resource hogs these days .
|
|
|
|
|
Hehhehe!
Hey why don't you also participate in the Q & A section? Just curious!
People with high attitude deserve the standing ovation of our highest finger!
My Blog![ ^]
|
|
|
|