コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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());
            }
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
        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());
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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());
            }
        }
コード例 #7
0
 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;
     }
 }
コード例 #8
0
        //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;
            }
        }