windows-phone

App Resuming event not firing when the app is resumed in WP 8.1 store app

♀尐吖头ヾ 提交于 2019-12-22 06:15:11
问题 My WP 8.1 store app behaves very strangely. App Resuming event fires as expected when I quickly navigate away and then come back. But If I keep the app in background for some time and when comes back, the app fires the Constructor and OnNavigatedTo events instead of the Resuming event and has the black "Resuming..." screen for a couple of seconds(about 4 seconds).This is an app with a BackgroundAudio task. Even the sample BackgroundAudio app from MS behaves like this. Anyone knows what's

Windows Phone: Call an Async method in OnNavigatedTo

折月煮酒 提交于 2019-12-22 05:18:54
问题 In my WP8 app, I want to call an Async method when the page is navigated to. I thought about marking the OnNavigatedTo method with async keyword to be like this: async protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); await myAsyncMethod(); } is there a better approach to achieve this, is there a problem in labeling OnNavigatedTo with async ? 回答1: Nope this is exactly what you should be doing. Mark OnNavigatedTo as async and then execute whatever you need

UWP: async read file into byte[]

半城伤御伤魂 提交于 2019-12-22 04:56:24
问题 I want to read a locally stored file into a byte array. How do I do that? This is my try: StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(filePath); var file = await folder.GetFileAsync(filePath); var buffer = await FileIO.ReadBufferAsync(file); DataReader dataReader = Windows.Storage.Streams.DataReader.FromBuffer(buffer); // doesn't work because ReadBytes wants a byte[] as parameter and also isn't asynchronous byte[] result = dataReader.ReadBytes(buffer.Length); 回答1:

UWP: async read file into byte[]

元气小坏坏 提交于 2019-12-22 04:56:02
问题 I want to read a locally stored file into a byte array. How do I do that? This is my try: StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(filePath); var file = await folder.GetFileAsync(filePath); var buffer = await FileIO.ReadBufferAsync(file); DataReader dataReader = Windows.Storage.Streams.DataReader.FromBuffer(buffer); // doesn't work because ReadBytes wants a byte[] as parameter and also isn't asynchronous byte[] result = dataReader.ReadBytes(buffer.Length); 回答1:

ListBox scrolling event in MVVM WPF

夙愿已清 提交于 2019-12-22 00:35:19
问题 Is there a way to hook to scroll event in WPF (Windows Phone7), in a MVVM manner? I'd like to detect when the list is scrolled to the bottom, and then do something. I tried something like this, but obviously it won't work: <ListBox ItemsSource="{Binding Places}" SelectedItem="{Binding SelectedPlace, Mode=TwoWay}"> <i:Interaction.Triggers> <i:EventTrigger EventName="Tap"> <i:InvokeCommandAction Command="{Binding ListBoxClick}"/> </i:EventTrigger> <i:EventTrigger EventName="Scroll"> <i

Windows Mobile TV stream

依然范特西╮ 提交于 2019-12-21 23:12:03
问题 I want to develop an application to play live stream on Windows mobile devices. Please give me an example of this. 回答1: That is a fairly broad question. There is a MediaElement control you can use to play video. Maybe the open source PlayerFramework is more helpful. It provides a way to play lots of content, including progressive downloads, streaming, live streaming, protected content, advertisements, etceteras. And you can style the player as you see fit. Have a look at http:/

access to input data from microphone in WP7?

爷,独闯天下 提交于 2019-12-21 22:21:52
问题 How can I access to input data from microphone in Windows Phone 7.0 or 7.1? (like a Volume Meter), i want to detect start and end input data from microphone. 回答1: Have a look at How to: Access the Microphone in a Silverlight Application for Windows Phone for basic usage. If you want to detect the start and stop of certain audio input you'll have to parse/process the returned stream yourself. 回答2: This blog post also has a great tutorial (and code) showing how you access the microphone in WP7

Binding to multiple indexers

偶尔善良 提交于 2019-12-21 21:24:33
问题 I am trying to bind an indexed property with two indexers. The property looks like this public Item this[int x, int y] { get { return _items[x, y]; } set { _items[x, y] = value; } } According to http://msdn.microsoft.com/en-us/library/ms742451.aspx, it is possible to bind against indexed properties like that <object Path="propertyName[index,index2...]" .../> There is even an example: <Rectangle Fill="{Binding ColorGrid[20,30].SolidColorBrushResult}" .../> However when I try to access that

Change system volume in Windows Phone 8

╄→гoц情女王★ 提交于 2019-12-21 17:19:00
问题 Up until now I thought that changing the system volume from your app is impossible, until recently a new app called Quite Hours (http://www.windowsphone.com/en-us/store/app/quiet-hours/f347a36b-80c0-430f-8631-e55046ee5a2a) actually did just that in a very neat way. Does anyone please know how to do that programmatically? I tried using the MediaElement or the xna MediaPlayer and the backgroundAudioPlayer and nothing worked. Any help would be appreciated! Thank you! 回答1: The developers of the

WP8 LongListSelector - re-assigning ItemsSource has no effect

杀马特。学长 韩版系。学妹 提交于 2019-12-21 09:22:28
问题 I'm using the new Windows Phone 8 LongListSelector control, which has its ItemsControl assigned to a List<Group<object>> as so: List<Group<PlacePoint>> searchResults; async void doSearch() { this.searchResults = await SearchHelper.Instance.getSearchResults(txtSearchTerm.Text); longList.ItemsSource = this.searchResults; } Unfortunately, the second time that I search, re-setting the .ItemsSource property has no effect and the control simply displays the old List. How can I change the binding?