public static void ShowAndActivate(this Window window)
        {
            try
            {
                Debug.Assert(window.Dispatcher.CheckAccess());

                window.Dispatcher.Invoke(() =>
                {
                    window.Show();
                    window.ActivateWindow();
                });
            }
            catch (Exception e)
            {
                Logger.Error($"An exception occured in the {window.Content.GetType()} dialog.", e);
            }
        }
Beispiel #2
0
        public static void ShowAndActivate(this Window window)
        {
            try
            {
                if (window.Dispatcher?.CheckAccess() ?? true)
                {
                    Action();
                }
                else
                {
                    window.Dispatcher.Invoke(Action);
                }
            }
            catch (Exception e)
            {
                Logger.Error($"An exception occured in the {window.Content.GetType()} dialog.", e);
            }

            void Action()
            {
                window.Show();
                window.ActivateWindow();
            }
        }
Beispiel #3
0
        public static void ShowAndActivate(this Window window)
        {
            try
            {
                if (window.Dispatcher.CheckAccess())
                {
                    Action();
                }
                else
                {
                    window.Dispatcher.Invoke(Action);
                }
            }
            catch
            {
                Debug.Fail($"An exception occured in the {window.Content.GetType()} dialog.");
            }

            void Action()
            {
                window.Show();
                window.ActivateWindow();
            }
        }