silverlight-4.0

Binding a UserControl to a custom BusyIndicator control

时光怂恿深爱的人放手 提交于 2019-12-02 11:45:14
问题 I have a requirement to focus on a specific textbox when a new view is loaded. The solution was to add this line of code to the OnLoaded event for the view: Dispatcher.BeginInvoke(() => { NameTextBox.Focus(); }); So this worked for one view, but not another. I spent some time debugging the problem and realized that the new view I was working on had a BusyIndicator that takes focus away from all controls since the BusyIndicator being set to true and false was occuring after the OnLoaded event.

Does Silverlight cache web service calls?

浪子不回头ぞ 提交于 2019-12-02 10:44:54
问题 Here's the problemo: My Silverlight application is calling a HTTP web service, using WebClient, called getCampaigns which returns a JSON array of data for Campaign objects. The user can then interact with the requested objects, modifying them, removing them, etc. When the user removes a campaign, Silverlight calls another web service, which flags the object in the database so it won't be returned in the future, and then refreshes the page by calling getCampaigns. The problem is the removed

Returning Azure BLOB from WCF service as a Stream - Do we need to close it?

不想你离开。 提交于 2019-12-02 09:08:57
I have a simple WCF service that exposes a REST endpoint, and fetches files from a BLOB container. The service returns the file as a stream. i stumbled this post about closing the stream after the response has been made : http://devdump.wordpress.com/2008/12/07/disposing-return-values/ This is my code: public class FileService { [OperationContract] [WebGet(UriTemplate = "{*url}")] public Stream ServeHttpRequest(string url) { var fileDir = Path.GetDirectoryName(url); var fileName = Path.GetFileName(url); var blobName = Path.Combine(fileDir, fileName); return getBlob(blobName); } private Stream

Listbox First Item Selected in mvvm

喜夏-厌秋 提交于 2019-12-02 06:28:17
I am new to mvvm. I have a listbox in my silverlight application which is binded to a observable collection in view model i want to make the listbox with first item selected. I tired this but it doesnt work. <ListBox Height="431" Canvas.Left="17" Canvas.Top="77" Width="215" FontSize="13" ItemsSource="{Binding Path=Categorys, Mode=TwoWay}" DataContext="{Binding}" SelectedItem="{Binding CurrentCategory, Mode=TwoWay}" ItemTemplate="{StaticResource CategoryDataTemplate}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Name="lst_category"> then i added this in mainpage load of mainpage

Which version of Silverlight Supports Task parallel Library

守給你的承諾、 提交于 2019-12-02 06:28:01
Though TPL is widely accepted as a feature of C# 4.0 , but heard that it is not supported on SL4, but SL5. Could not find any solid evidence of it. So why the do MicroSoft implemented a feature in WPF but not Silverlight, though both sl4 and wpf4 released around same time. If you need TCL in Silverlight 4 you can add the " Microsoft.Bcl " and "Microsoft.Bcl.Async" nuGet packages to your project. They implement part of what TCL delivers in .net. More info can be found here Don't forget you have to use the TaskEx class instead. Hoped it helped. 来源: https://stackoverflow.com/questions/18396139

Punycode converter at C#

那年仲夏 提交于 2019-12-02 05:57:12
问题 I need a punycode converter for Silverlight. For WPF have such an opportunity in the standard libraries. I need a ready-made library or code of functions (punycode encoding and decoding) {C#, Silverlight}. 回答1: I am not sure if Silverlight has access to this namespace but take a look at these IdnMapping fuunctions which are built into the .net framework. 来源: https://stackoverflow.com/questions/5125566/punycode-converter-at-c-sharp

Get list of network printers silverlight

一曲冷凌霜 提交于 2019-12-02 05:24:33
问题 I want to get the list of network printers through silverlight. I have seen a few examples of using WMI, but they are not available in Silverlight, so, I was wondering if there are any alternatives to find network printers through silverlight or at least the installed printers... There is also a question posted here 回答1: In Silverlight 5, you can use EnumPrinters Win32 API call through PInvoke. The code is pretty long, so I put together a sample that shows how to enumerate the printers on the

Binding a UserControl to a custom BusyIndicator control

我的梦境 提交于 2019-12-02 05:05:32
I have a requirement to focus on a specific textbox when a new view is loaded. The solution was to add this line of code to the OnLoaded event for the view: Dispatcher.BeginInvoke(() => { NameTextBox.Focus(); }); So this worked for one view, but not another. I spent some time debugging the problem and realized that the new view I was working on had a BusyIndicator that takes focus away from all controls since the BusyIndicator being set to true and false was occuring after the OnLoaded event. So the solution is to call focus to the NameTextBox after my BusyIndicator has been set to false. My

Does Silverlight cache web service calls?

别来无恙 提交于 2019-12-02 03:04:05
Here's the problemo: My Silverlight application is calling a HTTP web service, using WebClient, called getCampaigns which returns a JSON array of data for Campaign objects. The user can then interact with the requested objects, modifying them, removing them, etc. When the user removes a campaign, Silverlight calls another web service, which flags the object in the database so it won't be returned in the future, and then refreshes the page by calling getCampaigns. The problem is the removed campaign still shows up. If I check the database, the campaign truly has been disabled, and if I close

how to set compile time validation on class instance members

跟風遠走 提交于 2019-12-02 02:31:16
I have created a class like below: class myclass { Public int myint; } Now I want to restrict the range of myint(min 5 and max 10). I want if any one set the value of myint which is not in the range it will give a compile time error(not runtime error) please help me how to achive it. It's experimental, but you could look into Spec# . It can provide you with more compile-time checks. Code Contracts are another option (but that's only available in certain editions of Visual Studio). Edit: Looks like code contacts may now be available as a standalone download! See this page ! You don't have that