Tag: windows phone 8 sdk

Windows Phone 8.1 Silverlight中的Toast通知参数

好的,所以我在8.1 SL项目中使用新的ToastNotificationManager而不是旧的ShellToast。 ShellToast在toast消息上有NavigationUri,这非常容易。 在新的祝酒词中,您必须根据本文自行指定启动参数。 但是看起来8.1 SL没有事件OnLaunched(LaunchActivatedEventArgs args)你应该在App.xaml.cs中监听参数: 第2步:处理应用程序的“OnLaunched”事件 当用户点击您的祝酒词或通过触摸选择它时,相关的应用程序将启动,并触发其OnLaunched事件。 注意如果您在Toast中未包含启动属性字符串,并且在选择Toast时您的应用程序已在运行,则不会触发OnLaunched事件。 此示例显示了OverLaunched事件的覆盖语法,您将在其中检索并处理通过Toast通知提供的启动字符串。 protected override void OnLaunched(LaunchActivatedEventArgs args) { string launchString = args.Arguments …. } 我的代码: // Using the ToastText02 toast template. ToastTemplateType toastTemplate = ToastTemplateType.ToastText02; // Retrieve the content part of the toast so we can change the text. XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate); //Find the text […]

Windows Phone 8 – 在项目中的现有txt文件中读取和写入

嗨,我遇到了问题,我创建了一个txt文件,我把它放在应用程序上。 我试图从中读取我之前写的内容。 使用该代码: public async Task WriteDataToFileAsync(string fileName, string content) { byte[] data = Encoding.Unicode.GetBytes(content); var folder = ApplicationData.Current.LocalFolder; var file = await folder.CreateFileAsync(fileName,CreationCollisionOption.ReplaceExisting); using (var s = await file.OpenStreamForWriteAsync()) { await s.WriteAsync(data, 0, data.Length); } } public async Task ReadFileContentsAsync(string fileName) { var folder = ApplicationData.Current.LocalFolder; try { var file = await folder.OpenStreamForReadAsync(fileName); using […]