public static IMsBoxWindow <string> GetMessageBoxCustomWindow(MessageBoxCustomParams @params) { var window = new CustomWindow(@params.Style); window.DataContext = new MsBoxCustomViewModel(@params, window); return(new MsBoxWindowBase <CustomWindow, string>(window)); }
/// <summary> /// Gets the fatal error window. /// </summary> /// <param name="title">The title.</param> /// <param name="header">The header.</param> /// <param name="message">The message.</param> /// <returns>MsgBox.BaseWindows.IMsBoxWindow<System.String>.</returns> public static FatalErrorMessageBox GetFatalErrorWindow(string title, string header, string message) { var parameters = new MessageBoxCustomParams { CanResize = false, ShowInCenter = true, ContentTitle = title, ContentHeader = header, ContentMessage = message, Icon = MsgBox.Enums.Icon.Error, WindowStartupLocation = WindowStartupLocation.CenterOwner }; if (Dispatcher.UIThread.CheckAccess()) { var font = ResolveFont(); var window = new MsgBox.Views.MsBoxCustomWindow(parameters.Style) { Icon = StaticResources.GetAppIcon(), FontFamily = font.GetFontFamily() }; parameters.Window = window; window.DataContext = new MsgBox.ViewModels.MsBoxCustomViewModel(parameters); return(new FatalErrorMessageBox(window)); } else { var task = Dispatcher.UIThread.InvokeAsync(() => { var window = new MsgBox.Views.MsBoxCustomWindow(parameters.Style) { Icon = StaticResources.GetAppIcon() }; parameters.Window = window; window.DataContext = new MsgBox.ViewModels.MsBoxCustomViewModel(parameters); return(new FatalErrorMessageBox(window)); }); Task.WaitAll(task); return(task.Result); } }
/// <summary> /// Initializes a new instance of the <see cref="FatalErrorMessageBox" /> class. /// </summary> /// <param name="window">The window.</param> public FatalErrorMessageBox(MessageBox.Avalonia.Views.MsBoxCustomWindow window) { this.window = window; }
public MsBoxCustomWindow(MsWindow window) { _window = window; }