Exemple #1
0
        private void ErrorExit(ExitCode exitCode = ExitCode.GeneralError)
        {
            var code = Convert.ChangeType(exitCode, exitCode.GetTypeCode());

            if (code != null)
            {
                var intCode = (int)code;

                DebugLog($"Exiting with code {intCode}, {exitCode}");
                if (Current == null)
                {
                    DebugLog(WpfApp.Properties.Resources.App_ErrorExit_No_application_reference);
                    Process.GetCurrentProcess().Kill();
                }
                else
                {
                    Current.Shutdown(intCode);
                }
            }
        }
Exemple #2
0
        private static void ErrorExit(ExitCode exitcode = ExitCode.GeneralError)
        {
            if (exitcode != null)
            {
                object code = Convert.ChangeType(exitcode, exitcode.GetTypeCode());
                if (code != null)
                {
                    int intCode = (int)code;

                    Logger.Info($"Exiting with code {intCode}, {exitcode}");
                    if (System.Windows.Application.Current == null)
                    {
                        Logger.Debug("No application reference");
                        System.Diagnostics.Process.GetCurrentProcess().Kill();
                    }
                    else
                    {
                        System.Windows.Application.Current.Shutdown(intCode);
                    }
                }
            }
        }