public static void Show(string windowTitle, UserControlBase control, string boolUpdateMethod, Window owner = null, bool isTopMost = false, bool autoSize = true, bool showOkButton = true, bool showCancelButton = true) { try { ControlDialog.window = new ControlWindow(windowTitle, control, boolUpdateMethod, false, autoSize, showOkButton, showCancelButton); if (owner != null) { ControlDialog.window.Owner = owner; } ControlDialog.window.Topmost = isTopMost; ControlDialog.window.Show(); } catch (Exception err) { MessageDisplay.Show(err.InnerExceptionMessage()); } finally { ControlDialog.window = null; } }
public static void Show(string windowTitle, UserControlBase control, string boolUpdateMethod, bool showOkButton = true, bool showCancelButton = true, bool autoSize = false, WindowState windowState = WindowState.Normal) { try { ControlWindow window = new ControlWindow(windowTitle, control, boolUpdateMethod, showOkButton, showCancelButton); window.AutoSize = autoSize; if (windowState != WindowState.Normal) { window.SourceInitialized += (s, a) => { window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.WindowState = windowState; }; } //window.WindowState = windowState; window.Closing += WindowShow_Closing; window.Show(); } catch (Exception err) { MessageBox.Show(err.InnerExceptionMessage()); } }
public static bool?ShowDialog( string windowTitle, UserControlBase control, string boolUpdateMethod, bool autoSize = true, bool showOkButton = true, bool showCancelButton = true) { try { ControlDialog.window = new ControlWindow(windowTitle, control, boolUpdateMethod, true, autoSize, showOkButton, showCancelButton); return(ControlDialog.window.ShowDialog()); } catch (Exception err) { MessageDisplay.Show(err.InnerExceptionMessage()); return(false); } finally { ControlDialog.window = null; } }
public static void Show(string windowTitle, UserControlBase control, string boolUpdateMethod, Window owner = null, bool isTopMost = false, bool autoSize = true, bool showOkButton = true, bool showCancelButton = true, double desiredSize = 0) { try { ControlDialog.window = new ControlWindow(windowTitle, control, boolUpdateMethod, false, autoSize, showOkButton, showCancelButton); if (owner != null) { ControlDialog.window.Owner = owner; } ControlDialog.window.Topmost = isTopMost; ControlDialog.window.Closing += ControlDialog.ControlWindow_Closing; if (desiredSize > ControlDialog.window.ScreenWidth().ToDouble()) { ControlDialog.FitToScreen(); } ControlDialog.window.Show(); } catch (Exception err) { MessageDisplay.Show(err.InnerExceptionMessage()); } }
public static bool?ShowDialog( string windowTitle, UserControlBase control, string boolUpdateMethod, bool autoSize = true, bool showOkButton = true, bool showCancelButton = true, double desiredSize = 0) { try { ControlDialog.window = new ControlWindow(windowTitle, control, boolUpdateMethod, true, autoSize, showOkButton, showCancelButton); ControlDialog.window.Closing += ControlDialog.ControlWindow_Closing; ControlDialog.window.Owner = Application.Current.MainWindow; if (desiredSize > ControlDialog.window.ScreenWidth().ToDouble()) { ControlDialog.FitToScreen(); } return(ControlDialog.window.ShowDialog()); } catch (Exception err) { MessageDisplay.Show(err.InnerExceptionMessage()); return(false); } }
private static void WindowShow_Closing(object sender, CancelEventArgs e) { try { ControlWindow window = sender.To <ControlWindow>(); window.Closing -= WindowShow_Closing; WindowsShowIsClosing?.Invoke(sender, window.UserControl, e); } catch (Exception err) { MessageBox.Show(err.InnerExceptionMessage()); } }
private static void ControlWindow_Closing(object sender, CancelEventArgs e) { try { ControlDialog.ControlDialogClosing?.Invoke(sender, e); } catch (Exception err) { ErrorLog.ShowError(err); } finally { ControlDialog.window = null; } }
//private static ControlWindow window; public static bool?ShowDialog(string windowTitle, UserControlBase control, string boolUpdateMethod, bool showOkButton = true, bool showCancelButton = true, bool autoSize = false, WindowState windowState = WindowState.Normal) { ControlWindow window = null; try { window = new ControlWindow(windowTitle, control, boolUpdateMethod, showOkButton, showCancelButton); window.AutoSize = autoSize; if (windowState != WindowState.Normal) { window.SourceInitialized += (s, a) => { window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.WindowState = windowState; window.SizeToContent = SizeToContent.Manual; }; } return(window.ShowDialog()); } catch (Exception err) { MessageBox.Show(err.InnerExceptionMessage()); return(false); } finally { window = null; } }