/// <summary> /// Show AlertBox and get Ok/Cancel result /// </summary> /// <param name="content">Alert Content</param> /// <returns></returns> public static AlertResult Show(object content) { AlertBox alertbox = null; Application.Current.Dispatcher.Invoke(new Action(() => { alertbox = new AlertBox(); })); alertbox.Owner = Application.Current.Windows[0]; alertbox.AlertContent = content; alertbox.WindowStartupLocation = WindowStartupLocation.CenterScreen; Application.Current.Dispatcher.Invoke(new Action(() => { alertbox.ShowDialog(); })); return(alertbox.Result); }
/// <summary> /// Show AlertBox with selection menu /// </summary> /// <param name="content">Alert Content</param> /// <param name="okMenus">When user click ok to show</param> /// <returns></returns> public static int Show(System.Collections.Generic.List <string> okMenus, object content) { AlertBox alertbox = null; Application.Current.Dispatcher.Invoke(new Action(() => { alertbox = new AlertBox(); })); alertbox.Owner = Application.Current.Windows[0]; alertbox.WindowStartupLocation = WindowStartupLocation.CenterScreen; alertbox.AlertContent = content; alertbox.updateOkMenu(okMenus); Application.Current.Dispatcher.Invoke(new Action(() => { alertbox.ShowDialog(); })); return(alertbox.SelectedIndex); }
/// <summary> /// Show AlertBox that will auto close /// </summary> /// <param name="content">Alert Content</param> public static void ShowOnly(object content) { AlertBox alertbox = null; Application.Current.Dispatcher.Invoke(new Action(() => { alertbox = new AlertBox(); })); alertbox.Owner = Application.Current.Windows[0]; alertbox.WindowStartupLocation = WindowStartupLocation.CenterScreen; alertbox.AlertContent = content; alertbox.AddOkCanCel = false; alertbox.AutoClose = true; Application.Current.Dispatcher.Invoke(new Action(() => { alertbox.ShowDialog(); alertbox.Closed += OnAlertBoxClosed; })); }