public static void Set(string message, WarnType type, Exception e = null, bool showAnyway = false) { JournalView.Set(message, type); if (type <= MaxShowingWarnType || showAnyway) { JournalLightWindow.Show(message, type); } if (type == WarnType.Fatal) { MessageBox.Show(message + "\r\n" + (e?.Message ?? string.Empty), "Критическая ошибка! Lazurite будет закрыт.", MessageBoxButton.OK, MessageBoxImage.Error); System.Windows.Application.Current.Shutdown(1); } }
public static void Show(string message, WarnType type) { if (!string.IsNullOrEmpty(message)) { Application.Current?.Dispatcher.BeginInvoke(new Action(() => { if (_current == null || _closed) { _current = new JournalLightWindow(); _current.Show(); } _current.Set(message, type); })); } }
public static void Set(string message, WarnType type, Exception e = null, bool showAnyway = false) { JournalView.Set(message, type); if (type <= MaxShowingWarnType || showAnyway) { JournalLightWindow.Show(message, type); } if (type == WarnType.Fatal) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { var mainWindow = Application.Current.Windows.Cast <Window>().FirstOrDefault(x => x is MainWindow); if (mainWindow != null) { MessageView.ShowMessage(message + "\r\n" + e?.Message, "Критическая ошибка!", Icons.Icon.Close, mainWindow.Content as Panel, () => Application.Current.Shutdown(1)); } })); } }