private async void ResetHyperlinkButton_Click(object sender, RoutedEventArgs e) { bool choice = false; var msgDialog = new Windows.UI.Popups.MessageDialog("确认重置启用站点及顺序?") { Title = "提示" }; msgDialog.Commands.Add(new Windows.UI.Popups.UICommand("确定", uiCommand => { choice = true; })); msgDialog.Commands.Add(new Windows.UI.Popups.UICommand("取消", uiCommand => { choice = false; })); await msgDialog.ShowAsync(); if (choice) { await BangumiData.ResetSitesEnabledOrder(); EnabledSites.Clear(); NotEnabledSites.Clear(); BangumiData.GetEnabledSites() .Select(it => SiteMetaWithKey.FromSiteMeta(it)).ToList() .ForEach(it => EnabledSites.Add(it)); BangumiData.GetDisabledSites() .Select(it => SiteMetaWithKey.FromSiteMeta(it)).ToList() .ForEach(it => NotEnabledSites.Add(it)); } }
private void ContentDialog_Loaded(object sender, RoutedEventArgs e) { BangumiData.GetEnabledSites() .Select(it => SiteMetaWithKey.FromSiteMeta(it)).ToList() .ForEach(it => EnabledSites.Add(it)); BangumiData.GetDisabledSites() .Select(it => SiteMetaWithKey.FromSiteMeta(it)).ToList() .ForEach(it => NotEnabledSites.Add(it)); }