public static async Task CreateDefaultList(bool clear = false) { if (JumpList.IsSupported()) { var jumplist = await JumpList.LoadCurrentAsync(); if (!jumplist.Items.Any() || clear) { jumplist.Items.Clear(); var args = new ToastNotificationArgs() { type = "jumplist", openBookmarks = true }; var item = JumpListItem.CreateWithArguments(JsonConvert.SerializeObject(args), "Open Bookmarks"); item.Logo = new Uri("ms-appx:///Assets/BadgeLogo.scale-100.png"); args.openBookmarks = false; args.openPrivateMessages = true; var item2 = JumpListItem.CreateWithArguments(JsonConvert.SerializeObject(args), "Open Private Messages"); item2.Logo = new Uri("ms-appx:///Assets/BadgeLogo.scale-100.png"); jumplist.Items.Add(item); jumplist.Items.Add(item2); var seperate = JumpListItem.CreateSeparator(); jumplist.Items.Add(seperate); await jumplist.SaveAsync(); } } }
public static async Task UpdateAsync(ISettingsService settingsService) { if (!JumpList.IsSupported()) { return; } try { var jumpList = await JumpList.LoadCurrentAsync(); jumpList.Items.Clear(); foreach (var profile in settingsService.GetAllProfiles()) { var item = JumpListItem.CreateWithArguments(ShellProfileFlag + profile.Id, profile.Name); item.Description = profile.Location; jumpList.Items.Add(item); } await jumpList.SaveAsync(); } catch (Exception e) { Logger.Instance.Error(e, "JumpList Update Exception"); } }
/// <summary> /// Add history items. /// </summary> /// <param name="historyItems">History items.</param> public async Task ChangeHistoryItems(IDictionary <long, string> historyItems) { if (!JumpList.IsSupported()) { return; } var jumpList = await JumpList.LoadCurrentAsync(); var oldItems = jumpList.Items .ToList() .Where(a => a.GroupName == HistoryGroupName) .ToList(); foreach (var oldItem in oldItems) { jumpList.Items.Remove(oldItem); } foreach (var historyItem in historyItems) { var item = JumpListItem.CreateWithArguments($"releasecardhistory:{historyItem.Key}", historyItem.Value); item.GroupName = HistoryGroupName; jumpList.Items.Add(item); } OrderItems(jumpList); try { await jumpList.SaveAsync(); } catch { // Sometimes it was cause application failure } }
/// <summary> /// Clears and re-creates all custom items in the app's jump list. /// </summary> public async Task RefreshJumpList() { if (!JumpList.IsSupported()) { return; } try { JumpList jumpList = await JumpList.LoadCurrentAsync(); jumpList.Items.Clear(); jumpList.SystemGroupKind = JumpListSystemGroupKind.None; string packageId = Package.Current.Id.Name; foreach (string color in new[] { "Blue", "Green", "Red", "Yellow" }) { var item = JumpListItem.CreateWithArguments(color, $"ms-resource://{packageId}/Resources/{color}NavItem/Content"); item.GroupName = $"ms-resource://{packageId}/Resources/JumpListGroupColors"; item.Logo = new Uri($"ms-appx:///Assets/JumpList/{color}.png"); jumpList.Items.Add(item); } await jumpList.SaveAsync(); } catch (Exception ex) { // TODO: Proper error handling. SaveAsync may fail, for example with exception // "Unable to remove the file to be replaced." (Exception from HRESULT 0x80070497) Debug.WriteLine(ex); } }
private async Task UpdateJumpList() { if (!JumpList.IsSupported()) { return; } try { JumpList jumpList = await JumpList.LoadCurrentAsync(); jumpList.SystemGroupKind = JumpListSystemGroupKind.None; jumpList.Items.Clear(); foreach (DirectionViewModel directionViewModel in AvailableDirections) { string itemName = string.Format("{0} → {1}", directionViewModel.OriginLanguage, directionViewModel.DestinationLanguage); string arguments = "dict:" + directionViewModel.OriginLanguageCode + directionViewModel.DestinationLanguageCode; JumpListItem jumpListItem = JumpListItem.CreateWithArguments(arguments, itemName); jumpListItem.Logo = LanguageCodes.GetCountryFlagUri(directionViewModel.OriginLanguageCode); jumpList.Items.Add(jumpListItem); } await jumpList.SaveAsync(); } catch { // in rare cases, SaveAsync may fail with HRESULT 0x80070497: "Unable to remove the file to be replaced." // this appears to be a common problem without a solution, so we simply ignore any errors here } }
/// <summary> /// 初始化单一实例应用程序对象。这是执行的创作代码的第一行, /// 已执行,逻辑上等同于 main() 或 WinMain()。 /// </summary> public App() { Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync( Microsoft.ApplicationInsights.WindowsCollectors.Metadata | Microsoft.ApplicationInsights.WindowsCollectors.Session); this.InitializeComponent(); this.Suspending += OnSuspending; this.Resuming += this.OnResuming; if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.StartScreen.JumpList")) { try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (JumpList.IsSupported() && credentialList.Count > 0) { SetSystemGroupAsync(); } else if (JumpList.IsSupported()) { DisableSystemJumpListAsync(); } } catch { if (JumpList.IsSupported()) { DisableSystemJumpListAsync(); } } //if (JumpList.IsSupported() && appSetting.Values.ContainsKey("idNum")) } //if (!appSetting.Values.ContainsKey("AllKBGray")) //{ // appSetting.Values["AllKBGray"] = false; //} if (!appSetting.Values.ContainsKey("CommunityPerInfo")) { appSetting.Values["CommunityPerInfo"] = false; } if (!appSetting.Values.ContainsKey("Community_headimg_src")) { appSetting.Values["Community_headimg_src"] = "ms-appx:///Assets/Community_nohead.png"; } if (!appSetting.Values.ContainsKey("isUseingBackgroundTask")) { appSetting.Values["isUseingBackgroundTask"] = true; addBackgroundTask(); } if (bool.Parse(appSetting.Values["isUseingBackgroundTask"].ToString())) { addBackgroundTask(); } //监听异常 CoreApplication.UnhandledErrorDetected += CoreApplication_UnhandledErrorDetected; }
static JumplistManager() { if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.StartScreen.JumpList")) { IsSupported = JumpList.IsSupported(); } }
private async Task RefreshJumpList() { if (JumpList.IsSupported()) { var instance = await JumpList.LoadCurrentAsync(); // Disable automatic jumplist. It doesn't work with Files UWP. instance.SystemGroupKind = JumpListSystemGroupKind.None; var jumpListItems = instance.Items.ToList(); // Clear all items to avoid localization issues instance.Items.Clear(); foreach (var temp in jumpListItems) { var jumplistItem = JumpListItem.CreateWithArguments(temp.Arguments, temp.DisplayName); jumplistItem.Description = jumplistItem.Arguments; jumplistItem.GroupName = "ms-resource:///Resources/JumpListRecentGroupHeader"; jumplistItem.Logo = new Uri("ms-appx:///Assets/FolderIcon.png"); instance.Items.Add(jumplistItem); } await instance.SaveAsync(); } }
private async void MainPage_Unloaded(object sender, RoutedEventArgs e) { if (JumpList.IsSupported()) { var list = await JumpList.LoadCurrentAsync(); list.Items.Clear();//建议每次在添加之前清除掉原先已经存在的数据 await list.SaveAsync(); } }
private async void CreateJumplist() { try { if (JumpList.IsSupported()) { JumpList jumpList = await JumpList.LoadCurrentAsync(); if (UtilityData.newUpdate) { jumpList.Items.Clear(); } if (jumpList.Items.Count == 0 || jumpList.Items.Count != 6) { jumpList.Items.Clear(); JumpListItem Messenger = JumpListItem.CreateWithArguments("jplFacebook", "Facebook"); JumpListItem Skype = JumpListItem.CreateWithArguments("jplTwitter", "Twitter"); JumpListItem Slack = JumpListItem.CreateWithArguments("jplInstagram", "Instagram"); //JumpListItem WhatsApp = JumpListItem.CreateWithArguments("jplWhatsApp", "WhatsApp"); JumpListItem WeChat = JumpListItem.CreateWithArguments("jplReddit", "Reddit"); JumpListItem jltSplitView = JumpListItem.CreateWithArguments("jplSplitView", "Split View"); Messenger.Logo = new Uri("ms-appx:///Assets/fb.png"); Skype.Logo = new Uri("ms-appx:///Assets/twitter.png"); Slack.Logo = new Uri("ms-appx:///Assets/instagram.png"); //WhatsApp.Logo = new Uri("ms-appx:///Assets/whatsapp.png"); WeChat.Logo = new Uri("ms-appx:///Assets/reddit.png"); jltSplitView.Logo = new Uri("ms-appx:///Assets/splitview.png"); Messenger.GroupName = "Services"; Skype.GroupName = "Services"; WeChat.GroupName = "Services"; //WhatsApp.GroupName = "Services"; Slack.GroupName = "Services"; jltSplitView.GroupName = "Services"; jumpList.Items.Add(Messenger); jumpList.Items.Add(Skype); jumpList.Items.Add(Slack); //jumpList.Items.Add(WhatsApp); jumpList.Items.Add(WeChat); jumpList.Items.Add(jltSplitView); await jumpList.SaveAsync(); } } } catch (Exception) { } }
/// <summary> /// Removes all jumplist items /// </summary> public static async Task RemoveAllAsync() { // Check if jumplists are supported if (!JumpList.IsSupported()) return; // Load the jumplist Items _systemJumpList = await JumpList.LoadCurrentAsync(); // Clear all jumplist items _systemJumpList.Items.Clear(); // Save the Jumplist Items await _systemJumpList.SaveAsync(); }
private async void Initialize() { if (JumpList.IsSupported()) { _instance = await JumpList.LoadCurrentAsync(); // Disable automatic jumplist. It doesn't work with Files UWP. _instance.SystemGroupKind = JumpListSystemGroupKind.None; JumpListItemPaths = _instance.Items.Select(item => item.Arguments).ToList(); } }
public JumplistManager() { if (Windows.ApplicationModel.DesignMode.DesignModeEnabled) { return; } if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.StartScreen.JumpList")) { IsSupported = JumpList.IsSupported(); } }
/// <summary> /// Adds a recent item to the jumplist /// </summary> /// <param name="args"></param> /// <param name="name"></param> /// <param name="description"></param> /// <param name="grp"></param> /// <param name="image"></param> /// <returns></returns> public static async Task AddRecentAsync(string args, string name, string description, string grp, Uri image) { try { // Check if jumplists are supported if (!JumpList.IsSupported()) { return; } // Load the jumplist _systemJumpList = await JumpList.LoadCurrentAsync(); // Change the kind to recent items _systemJumpList.SystemGroupKind = JumpListSystemGroupKind.Recent; // Check that the item is not already added if (_systemJumpList.Items.FirstOrDefault(x => x.Arguments == args) != null) { return; } // Loop through all the items and remove any items that will cause the jumplist // to go over 5 items (we only want 5 recent items max). while (_systemJumpList.Items.Count(x => x.GroupName == grp) >= 5) { // Get a item var recentItem = _systemJumpList.Items.FirstOrDefault(x => x.GroupName == grp); // Check that the item is not null if (recentItem != null) { // Remove the item from the list _systemJumpList.Items.Remove(recentItem); } } // Create a new jumplist item var item = JumpListItem.CreateWithArguments(args, name); item.Description = description; item.GroupName = grp; item.Logo = image; // Add the item to the jumplist _systemJumpList.Items.Add(item); // Save the jumplist await _systemJumpList.SaveAsync(); } catch { await new MessageDialog("An Error Occured while pinning this item to the jumplist.", "Jumplist Error").ShowAsync(); } }
/// <summary> /// Gets a list of all the jumplists /// if supported by the platform /// </summary> public static async Task <IList <JumpListItem> > GetItemsAsync() { // Check if jumplists are supported if (!JumpList.IsSupported()) { return(new List <JumpListItem>()); } // Load the jumplist items _systemJumpList = await JumpList.LoadCurrentAsync(); // Return the items return(_systemJumpList.Items); }
/// <summary> /// Gets a list of all the jumplist IDs /// if supported by the platform /// <param name="groupName">The group to get</param> /// </summary> public static async Task <List <string> > GetJumpListIDsAsync(string groupName) { // Check if jumplists are supported if (!JumpList.IsSupported()) { return(new List <string>()); } // Get a list of jumplist items var itemList = await GetItemsAsync(); // Return the list return(itemList.Where(x => x.GroupName == groupName).Select(x => x.Arguments).Select(item => item.Split('=')[1]).ToList()); }
private static async Task ClearJumpListAsync() { if (JumpList.IsSupported()) { var list = await JumpList.LoadCurrentAsync(); list.Items.Clear(); await list.SaveAsync(); } if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5)) { await ContactListManager.ClearContactsAsync(); } }
public async Task OpenSolutionAsync(IStorageFolder folder) { AccessListEntry accessListEntry = RecentSolutions.FirstOrDefault(e => e.Metadata == folder.Path); if (string.IsNullOrEmpty(accessListEntry.Token)) { string token = StorageApplicationPermissions.MostRecentlyUsedList.Add(folder, folder.Path); accessListEntry = new AccessListEntry { Token = token, Metadata = folder.Path }; RecentSolutions.Add(accessListEntry); } if (JumpList.IsSupported()) { JumpList jumpList = await JumpList.LoadCurrentAsync(); jumpList.SystemGroupKind = JumpListSystemGroupKind.Recent; JumpListItem?existingJumpListItem = jumpList.Items.FirstOrDefault(j => j.Arguments == accessListEntry.Token); if (existingJumpListItem is null || existingJumpListItem.RemovedByUser) { JumpListItem jumpListItem = JumpListItem.CreateWithArguments(accessListEntry.Token, folder.Name); jumpListItem.Description = folder.Path; jumpListItem.GroupName = "Recent"; jumpList.Items.Add(jumpListItem); } await jumpList.SaveAsync(); } if (RootFolder != null) { await CoreApplication.RequestRestartAsync(accessListEntry.Token); } else { RootFolder = (StorageFolder)folder; await RegisterBackgroundTaskAsync(); RootFolderLoaded?.Invoke(this, new RootFolderLoadedEventArgs(RootFolder)); await LoadSolutionAsync(); } }
private void lanunchCore(IActivatedEventArgs e, bool prelaunchActivated) { #if !DEBUG if (!AppCenter.Configured) { var region = new Windows.Globalization.GeographicRegion(); AppCenter.SetCountryCode(region.CodeTwoLetter); AppCenter.Start(Telemetry.AppCenterKey, typeof(Analytics), typeof(Crashes)); } #endif if (Opportunity.MvvmUniverse.Services.Notification.Notificator.GetForCurrentView().Handlers.Count == 0) { Opportunity.MvvmUniverse.Services.Notification.Notificator.GetForCurrentView().Handlers.Add(new Services.ContentDialogNotification()); Opportunity.MvvmUniverse.Services.Notification.Notificator.GetForCurrentView().Handlers.Add(new Services.InAppToastNotification()); } var currentWindow = Window.Current; var currentContent = currentWindow.Content; if (currentContent is null) { var view = ApplicationView.GetForCurrentView(); view.SetPreferredMinSize(new Size(320, 500)); CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; if (JumpList.IsSupported()) { Task.Run(async() => { var jl = await JumpList.LoadCurrentAsync(); jl.SystemGroupKind = JumpListSystemGroupKind.None; await jl.SaveAsync(); }); } currentContent = new SplashControl(e.SplashScreen); currentWindow.Content = currentContent; } if (currentContent is SplashControl sc) { if (!prelaunchActivated) { sc.EnableGoToContent(); } } else { currentWindow.Activate(); } ((Opportunity.UWP.Converters.Typed.StringToBooleanConverter) this.Resources["EmptyStringToFalseConverter"]).ValuesForFalse.Add(""); }
public static async Task AddNewJumplistForum(ForumEntity forum) { if (!JumpList.IsSupported()) { return; } var jumplist = await JumpList.LoadCurrentAsync(); var itemExists = false; foreach (var item in jumplist.Items) { var args = JsonConvert.DeserializeObject <ToastNotificationArgs>(item.Arguments); if (args == null) { continue; } if (args.openPrivateMessages || args.openBookmarks) { continue; } if (args.openForum && args.forumId == forum.Id) { itemExists = true; } } if (itemExists) { return; } var newArgs = new ToastNotificationArgs() { type = "jumplist", openForum = true, forumId = forum.Id }; var jumpItem = JumpListItem.CreateWithArguments(JsonConvert.SerializeObject(newArgs), $"Open {forum.Name}"); jumpItem.Logo = new Uri("ms-appx:///Assets/BadgeLogo.scale-100.png"); jumplist.Items.Add(jumpItem); await jumplist.SaveAsync(); }
public async Task JumpListAsync() { if (JumpList.IsSupported()) { var current = await JumpList.LoadCurrentAsync(); current.SystemGroupKind = JumpListSystemGroupKind.None; current.Items.Clear(); var cloud = JumpListItem.CreateWithArguments(string.Format("from_id={0}", _cacheService.Options.MyId), Strings.Resources.SavedMessages); cloud.Logo = new Uri("ms-appx:///Assets/JumpList/SavedMessages/SavedMessages.png"); current.Items.Add(cloud); await current.SaveAsync(); } }
/// <summary> /// Refresh group contains main pages of application. /// </summary> public async Task RefreshPagesGroup() { if (!JumpList.IsSupported()) { return; } JumpList jumpList = null; try { jumpList = await JumpList.LoadCurrentAsync(); } catch { return; } var oldItems = jumpList.Items .ToList() .Where(a => a.GroupName == PagesGroupName) .ToList(); foreach (var oldItem in oldItems) { jumpList.Items.Remove(oldItem); } var releasesItem = JumpListItem.CreateWithArguments($"openreleasepage", "Каталог релизов"); releasesItem.GroupName = PagesGroupName; jumpList.Items.Add(releasesItem); var videoPlayerItem = JumpListItem.CreateWithArguments($"openvideoplayer", "Видеоплеер"); videoPlayerItem.GroupName = PagesGroupName; jumpList.Items.Add(videoPlayerItem); OrderItems(jumpList); try { await jumpList.SaveAsync(); } catch { // Sometimes it was cause application failure } }
public async Task <bool> AddAsync(string argument, string display, string image = null, int max = 5, JumpListSystemGroupKind kind = JumpListSystemGroupKind.Recent) { if (JumpList.IsSupported()) { var jumpList = await JumpList.LoadCurrentAsync(); jumpList.SystemGroupKind = kind; jumpList.RemoveExisting(display); jumpList.InsertItem(argument, display, image, string.Empty, string.Empty); jumpList.TrimItems(max); return(await jumpList.TrySaveAsync()); } else { return(false); } }
/// <summary> /// Adds a recent item to the jumplist /// </summary> /// <param name="args">Arguments to pass when the app opens</param> /// <param name="name">Name of the item</param> /// <param name="description">Hover description</param> /// <param name="grp">Grouping</param> /// <param name="image">Image to display</param> public static async Task AddRecentAsync(string args, string name, string description, string grp, Uri image) { try { // Check if jumplists are supported if (!JumpList.IsSupported()) return; // Load the jumplist _systemJumpList = await JumpList.LoadCurrentAsync(); // Change the kind to recent items _systemJumpList.SystemGroupKind = JumpListSystemGroupKind.Recent; // Check that the item is not already added if (_systemJumpList.Items.FirstOrDefault(x => x.Arguments == args) != null) return; // Loop through all the items and remove any items that will cause the jumplist // to go over 5 items (we only want 5 recent items max). while (_systemJumpList.Items.Count(x => x.GroupName == grp) >= 5) { // Get a item var recentItem = _systemJumpList.Items.FirstOrDefault(x => x.GroupName == grp); // Check that the item is not null if (recentItem != null) _systemJumpList.Items.Remove(recentItem); } // Create a new jumplist item var item = JumpListItem.CreateWithArguments(args, name); item.Description = description; item.GroupName = grp; item.Logo = image; // Add the item to the jumplist _systemJumpList.Items.Add(item); // Save the jumplist await _systemJumpList.SaveAsync(); } catch (Exception ex) { TelemetryService.Instance.TrackException(ex); } }
private async void Initialize() { try { if (JumpList.IsSupported()) { instance = await JumpList.LoadCurrentAsync(); // Disable automatic jumplist. It doesn't work with Files UWP. instance.SystemGroupKind = JumpListSystemGroupKind.None; JumpListItemPaths = instance.Items.Select(item => item.Arguments).ToList(); } } catch (Exception ex) { App.Logger.Warn(ex, ex.Message); instance = null; } }
// ############################################################################################### /// Set the JumpList of the app private async Task SetJumpList() { if (!JumpList.IsSupported()) { return; } try { var jumpList = await JumpList.LoadCurrentAsync(); jumpList.Items.Clear(); JumpListItem taskItem; taskItem = JumpListItem.CreateWithArguments("/News", "News"); taskItem.Description = "See the latest news."; taskItem.DisplayName = "News"; taskItem.Logo = new Uri("ms-appx:///Assets/Icons/News.png"); jumpList.Items.Add(taskItem); taskItem = JumpListItem.CreateWithArguments("/Portfolio", "Portfolio"); taskItem.Description = "Check your crypto-portfolio."; taskItem.DisplayName = "Portfolio"; taskItem.Logo = new Uri("ms-appx:///Assets/Icons/Portfolio.png"); jumpList.Items.Add(taskItem); await jumpList.SaveAsync(); } catch (SystemException ex) { Analytics.TrackEvent("Jumplist-errorCatched", new Dictionary <string, string>() { { "Exception", ex.Message } }); } catch (Exception ex) { Analytics.TrackEvent($"Jumplist-error", new Dictionary <string, string>() { { "Exception", ex.Message } }); } }
private async void MainPage_Loaded(object sender, RoutedEventArgs e) { if (JumpList.IsSupported()) { var list = await JumpList.LoadCurrentAsync(); list.Items.Clear();//建议每次在添加之前清除掉原先已经存在的数据 list.Items.Add(JumpListItem.CreateSeparator()); new List <JumpListItem>() { //CreateJumpListItem("feed","动态","页面",new Uri("ms-appx:///Assets/facebook.png")), //CreateJumpListItem("notification","通知","页面",new Uri("ms-appx:///Assets/github.png")), CreateJumpListItem("test", "打开测试页面", "测试", new Uri("ms-appx:///Assets/Icons/ic_settings_white_24dp.png")), //CreateJumpListItem("settings","设置","页面",new Uri("ms-appx:///Assets/Icons/ic_settings_white_24dp.png")) }.ForEach((item) => { list.Items.Add(item); }); await list.SaveAsync(); } }
private async Task ConfigureJumpList() { if (JumpList.IsSupported() == true) { JumpList jumpList = await JumpList.LoadCurrentAsync(); if (jumpList.Items.Count == 0) { jumpList.Items.Clear(); JumpListItem OpenJumpListItem = JumpListItem.CreateWithArguments("OpenFile", "Open File"); jumpList.Items.Add(OpenJumpListItem); try { await jumpList.SaveAsync(); } catch (Exception) { } } } }
public static async Task Update(IEnumerable <ShellProfile> profiles) { try { if (JumpList.IsSupported()) { var jumpList = await JumpList.LoadCurrentAsync(); jumpList.Items.Clear(); foreach (var profile in profiles) { var item = JumpListItem.CreateWithArguments(ShellProfileFlag + profile.Id.ToString(), profile.Name); item.Description = profile.Location; item.Logo = new Uri("ms-appx:///Assets/AppIcons/Full-transparent.png"); jumpList.Items.Add(item); } await jumpList.SaveAsync(); } }catch (Exception e) { Logger.Instance.Error(e, "JumpList Update Exception"); } }
private async void SwitchAppBarButton_Click(object sender, RoutedEventArgs e) { //appSetting.Values.Remove("idNum"); try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); foreach (var item in credentialList) { vault.Remove(item); } } catch { } appSetting.Values["CommunityPerInfo"] = false; appSetting.Values["isUseingBackgroundTask"] = false; IStorageFolder applicationFolder = ApplicationData.Current.LocalFolder; IStorageFile storageFileWR = await applicationFolder.CreateFileAsync("kb", CreationCollisionOption.OpenIfExists); try { await storageFileWR.DeleteAsync(); if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.StartScreen.JumpList")) { if (JumpList.IsSupported()) { DisableSystemJumpListAsync(); } } } catch (Exception) { Debug.WriteLine("个人 -> 切换账号删除课表数据异常"); } Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }