Example #1
0
            private static void RunMethod(Action action, string successfulMessage)
            {
                try {
                    action();

                    if (!string.IsNullOrEmpty(successfulMessage))
                    {
                        ShowMessageBox.Information(successfulMessage);
                    }
                }
                catch (Exception exception) {
                    ShowMessageBox.Error(exception.Message);
                }
            }
Example #2
0
            public static void TrueDialogResult <TWindow>(TWindow window) where TWindow : Window, IWindowWithChecking
            {
                var errors = window.GetErrors().ToArray();

                if (errors.Any())
                {
                    ShowMessageBox.Error(string.Join("\n", errors));
                    return;
                }

                SafeRunMethod.WithoutReturn(() => {
                    window.ActionBeforeTrueDialogResultClose();
                    window.DialogResult = true;
                    window.Close();
                });
            }
Example #3
0
            public static void TrueDialogResult <TWindow>(TWindow window) where TWindow : Window, IProxyWindow
            {
                if (window.IsReadOnly)
                {
                    window.Close();
                    return;
                }

                var errors = window.GetErrors().ToArray();

                if (errors.Any())
                {
                    ShowMessageBox.Error(string.Join("\n", errors));
                }
                else
                {
                    window.WriteProxy();
                    window.DialogResult = true;
                    window.Close();
                }
            }