private void Button_Генерировать(object sender, RoutedEventArgs e) { try { //СохранитьНастройки(); if (App.Модель.IsBusy) { return; } App.Модель.IsBusy = true; GraphList.BeginInit(); districtsGrid.BeginInit(); narydsGrid.BeginInit(); var wor = new BackgroundWorker(); wor.DoWork += (o, args) => App.Модель.GenerateEvents(); wor.RunWorkerCompleted += (o, args) => { ОбновитьВсё(null, null); GraphList.EndInit(); districtsGrid.EndInit(); narydsGrid.EndInit(); App.Модель.IsBusy = false; wor.Dispose(); }; wor.RunWorkerAsync(); } catch (Exception ex) { MessageBox.Show(string.Format("{0}\n{1}", ex.Message, ex.StackTrace), "Исключение"); } }
private void Button_Очистить(object sender, RoutedEventArgs e) { GraphList.BeginInit(); App.Модель.ClearEvents(); ОбновитьВсё(null, null); GraphList.EndInit(); }