private async void OnLoadData() { base._progressService.Show(); if (this.Categories.Count == 0) { try { var categories = await serviceBroker.GetCategories(); if (categories.status.ToLower() == "ok") { var filtered = categories.categories.Where(o => o.parent == 0); foreach (var item in filtered) { this.Categories.Add(new Models.Ui.Item { Title = item.title.ToLower(), ItemId = item.id.ToString(), Description = item.description }); } await LoadLastPosts(); } else { throw new Exception(categories.status); } } catch (Exception ex) { this._progressService.Hide(); var dialogViewModel = new DialogViewModel { Title = "»ñÈ¡·ÖÀà´íÎó", Text = ex.Message }; this._windowManager.ShowPopup(dialogViewModel); } } }
public void ClearCache() { var dialogViewModel = new DialogViewModel { Title = "提示", Text = "您确定要清除所有缓存吗?" }; dialogViewModel.Deactivated += (sender, args) => { if (dialogViewModel.Result == DialogResult.Ok) { //this.ShowToast("清除缓存"); this.ClearCacheMethod(); } else SystemTray.Opacity = 0; }; _windowManager.ShowDialog(dialogViewModel); }