private bool TryInitiateShutdown()
        {
            var hasQuitPassword = !String.IsNullOrEmpty(Settings.QuitPasswordHash);
            var requestShutdown = false;

            if (hasQuitPassword)
            {
                requestShutdown = TryValidateQuitPassword();
            }
            else
            {
                requestShutdown = TryConfirmShutdown();
            }

            if (requestShutdown)
            {
                var communication = runtime.RequestShutdown();

                if (communication.Success)
                {
                    return(true);
                }
                else
                {
                    logger.Error("Failed to communicate shutdown request to the runtime!");
                    messageBox.Show(TextKey.MessageBox_QuitError, TextKey.MessageBox_QuitErrorTitle, icon: MessageBoxIcon.Error);
                }
            }

            return(false);
        }
示例#2
0
        private bool TryRequestShutdown()
        {
            var communication = runtime.RequestShutdown();

            if (!communication.Success)
            {
                logger.Error("Failed to communicate shutdown request to the runtime!");
                messageBox.Show(TextKey.MessageBox_QuitError, TextKey.MessageBox_QuitErrorTitle, icon: MessageBoxIcon.Error);
            }

            return(communication.Success);
        }