private void ReadNetwork_OnClick(object sender, RoutedEventArgs e) { var filename = GetPathFromDialog(); try { _network = _networkInfoRetriever.Read(filename) as Network; ReasignNetwork(); MessageBox.Show("File loaded!", "OK", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.None); _headerUpdater?.Stop(); _headerUpdater = null; _backgroundWorker?.Stop(); _backgroundWorker = null; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.None); } }
private void Stop_OnClick(object sender, RoutedEventArgs e) { if (_backgroundWorker != null) { _headerUpdater?.Stop(); _headerUpdater = null; _backgroundWorker.Stop(); _backgroundWorker = null; var statistic = _messagesStatisticCounter.Count(); var messageStatisticWindow = new MessagesStatisticWindow(statistic); messageStatisticWindow.Show(); } }