windows-phone-7.1

Run “async” method on a background thread

守給你的承諾、 提交于 2021-02-06 14:28:39
问题 I'm trying to run an "async" method from an ordinary method: public string Prop { get { return _prop; } set { _prop = value; RaisePropertyChanged(); } } private async Task<string> GetSomething() { return await new Task<string>( () => { Thread.Sleep(2000); return "hello world"; }); } public void Activate() { GetSomething.ContinueWith(task => Prop = task.Result).Start(); // ^ exception here } The exception thrown is: Start may not be called on a continuation task. What does that mean, anyway?

Run “async” method on a background thread

六月ゝ 毕业季﹏ 提交于 2021-02-06 14:26:52
问题 I'm trying to run an "async" method from an ordinary method: public string Prop { get { return _prop; } set { _prop = value; RaisePropertyChanged(); } } private async Task<string> GetSomething() { return await new Task<string>( () => { Thread.Sleep(2000); return "hello world"; }); } public void Activate() { GetSomething.ContinueWith(task => Prop = task.Result).Start(); // ^ exception here } The exception thrown is: Start may not be called on a continuation task. What does that mean, anyway?

Run “async” method on a background thread

天大地大妈咪最大 提交于 2021-02-06 14:26:00
问题 I'm trying to run an "async" method from an ordinary method: public string Prop { get { return _prop; } set { _prop = value; RaisePropertyChanged(); } } private async Task<string> GetSomething() { return await new Task<string>( () => { Thread.Sleep(2000); return "hello world"; }); } public void Activate() { GetSomething.ContinueWith(task => Prop = task.Result).Start(); // ^ exception here } The exception thrown is: Start may not be called on a continuation task. What does that mean, anyway?

Bug in WP 7 implementation of Uri.IsWellFormedUriString?

≡放荡痞女 提交于 2020-06-14 04:10:39
问题 In a .NET 4 console application, and a Silverlight 4 application, the following returns false : Uri.IsWellFormedUriString ("/test", UriKind.Absolute) but the same call in a Windows Phone app (7.0 or 7.1 using SDK 7.1 Beta 2 published 6/29/11) returns true . Can anyone else confirm this? Is this a bug in WP7? Update I reported this as a bug on Microsoft Connect and received an update today that it has been closed as "Wont' Fix". This doesn't matter to me but I thought I would add this update

Bug in WP 7 implementation of Uri.IsWellFormedUriString?

*爱你&永不变心* 提交于 2020-06-14 04:10:11
问题 In a .NET 4 console application, and a Silverlight 4 application, the following returns false : Uri.IsWellFormedUriString ("/test", UriKind.Absolute) but the same call in a Windows Phone app (7.0 or 7.1 using SDK 7.1 Beta 2 published 6/29/11) returns true . Can anyone else confirm this? Is this a bug in WP7? Update I reported this as a bug on Microsoft Connect and received an update today that it has been closed as "Wont' Fix". This doesn't matter to me but I thought I would add this update

VS Developer Express for Windows Phone new project shows XamlParseException

浪子不回头ぞ 提交于 2020-02-07 04:08:29
问题 I recently installed windows 8 along with Visual Studio Express 2012 for Windows Phone. However, if I start a new Windows Phone App project (7.1, although 8 has the same issue) and open the MainPage.xaml file, an error appears in the designer window as follows: XamlParseException: Cannot find a Resource with the Name/Key PhoneBackgroundBrush [Line: 47 Position: 111] The MainPage.xaml file is as follows: <phone:PhoneApplicationPage x:Class="PhoneApp1.MainPage" xmlns="http://schemas.microsoft

VS Developer Express for Windows Phone new project shows XamlParseException

妖精的绣舞 提交于 2020-02-07 04:08:06
问题 I recently installed windows 8 along with Visual Studio Express 2012 for Windows Phone. However, if I start a new Windows Phone App project (7.1, although 8 has the same issue) and open the MainPage.xaml file, an error appears in the designer window as follows: XamlParseException: Cannot find a Resource with the Name/Key PhoneBackgroundBrush [Line: 47 Position: 111] The MainPage.xaml file is as follows: <phone:PhoneApplicationPage x:Class="PhoneApp1.MainPage" xmlns="http://schemas.microsoft

Windows Phone - Marquee With Template

一个人想着一个人 提交于 2020-01-25 02:22:27
问题 In windows phone i could easily marquee a textblock. But is there any solution to marquee list of items for which i can define template and bind it to a list of items. Thanks Gokoulane Ravi 回答1: Although it's not a WP style... Add storyboard to page resources: <phone:PhoneApplicationPage.Resources> <Storyboard x:Name="Scroll" RepeatBehavior="Forever"> <DoubleAnimation From="480" To="-480" Storyboard.TargetName="translate" Storyboard.TargetProperty="X" Duration="0:0:5" /> </Storyboard> </phone

Code in Application_Activated not running when phone wakes up

余生颓废 提交于 2020-01-23 17:29:08
问题 I've done some reseach on the life cycle of Windows Phone apps and I've gathered that when the phone is locked whilst an app is still running, and you unlock the phone the 'Application_Activated' function is called in the App.xaml.cs file. // Code to execute when the application is activated (brought to foreground) // This code will not execute when the application is first launched private void Application_Activated(object sender, ActivatedEventArgs e) { //Code to run MessageBox.Show("Hello

Finding the exact position of a graphical object in relation to some other Canvas

余生颓废 提交于 2020-01-17 04:49:08
问题 I have a ListBox, and when I select an item in that ListBox I want to duplicate the image and place it on the Canvas containing all the other objects in my app. This works fine for the most part, however if the item in the ListBox is further in, such that I have to scroll to see the item, the coordinates are no longer accurate. Is there a function such as Canvas.getGlobalPosition(UIElement), which would allow me to then set Canvas.SetTop(uiElement, globalCoordinateSpace.Y) and allow me to