private async void ModernExpander_Expanded(object sender, RoutedEventArgs e) { if ((sender as Expander).Name == nameof(expNew)) { if (expHistory.IsExpanded) { expHistory.IsExpanded = false; } //(App.Current.MainWindow as MainWindow).IsBusy = true; await LoadProcesses(); //(App.Current.MainWindow as MainWindow).IsBusy = false; } else { if (expNew.IsExpanded) { expNew.IsExpanded = false; } ProcessesMonitorHistory.Clear(); histories = ProcessMonitorHelper.GetHistory(); foreach (var item in histories.Keys) { ProcessesMonitorHistory.Add(item); } } }
private void Button_Click_2(object sender, RoutedEventArgs e) { try { FileInfo file = histories[ProcessesMonitorHistory.First(p => p.DisplayId == (sender as Button).Tag as string)]; string jsonText = File.ReadAllText(file.FullName); var items = Newtonsoft.Json.JsonConvert.DeserializeObject<ObservableCollection<ProcessMonitorInfo>>(jsonText); SetTableItemsSource(items); } catch (Exception ex) { WpfControls.Dialog.DialogHelper.ShowException("加载历史信息失败", ex); } }