private void ShowConfigureAndRunWindow()
        {
            ExecutionOptionsViewModel opVM = new ExecutionOptionsViewModel(Model);
            ExecutionsOptionsView     view = new ExecutionsOptionsView(opVM);
            YesNoWindow win = new YesNoWindow(view, opVM);

            win.ShowDialog();
        }
Exemple #2
0
        public static MessageBoxWrapperResult Show(string message, string warning, MessageBoxWrapperButton messageBoxWrapperButton)
        {
            YesNoWindow yn = new YesNoWindow(message, warning);

            yn.ShowDialog();
            if (yn.DialogResult.HasValue && yn.DialogResult.Value)
            {
                return(MessageBoxWrapperResult.Yes);
            }
            return(MessageBoxWrapperResult.No);
        }
        public static bool ShowQuestionWindow(string msg, string sub, string question)
        {
            YesNoWindow wnd    = new YesNoWindow(msg, sub, question);
            bool        answer = false;

            if (wnd.ShowDialog() == true)
            {
                answer = true;
            }

            return(answer);
        }
        private void deleteButton_Click(object sender, RoutedEventArgs e)
        {
            YesNoWindow yy = new YesNoWindow("Do you want to delete this task ?");

            yy.ShowDialog();
            if (yy.ans == true)
            {
                bolayer.task_delete(tasknow);
                ftp.deletefile(tasknow.folder);
                bolayer.load_task_form_server();
            }
        }
        private void MainWindow_OnClosing(object sender, CancelEventArgs e)
        {
            YesNoWindow dialog = new YesNoWindow("Save Game", "Do you want to save game?");

            dialog.Owner = GetWindow(this);
            dialog.ShowDialog();

            if (dialog.ClickedYes)
            {
                SaveGame();
            }
        }
Exemple #6
0
        private void AskToSaveGame()
        {
            YesNoWindow message =
                new YesNoWindow("Save Game", "Do you want to save your game?");

            message.Owner = GetWindow(this);
            message.ShowDialog();

            if (message.ClickedYes)
            {
                SaveGame();
            }
        }
Exemple #7
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            YesNoWindow message = new YesNoWindow("Save game", "Do you want to save your game?")
            {
                Owner = GetWindow(this)
            };

            message.ShowDialog();

            if (message.ClickedYes)
            {
                SaveGame();
            }
        }
        private bool ShowSimulationInvitationWindow(int simulationID, string firstLine, string secondLine)
        {
            YesNoWindow  invitation = new YesNoWindow(firstLine, secondLine);
            DialogResult result     = invitation.ShowDialog();
            bool         yes        = false;

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                this.Dispatcher.Invoke(new LoadDelegate(this.LoadSimulation), new object[] { simulationID });
                this.Dispatcher.Invoke(new ToggleStateChangerDelegate(this.ToggleStateChanger), new object[] { 1 });
                yes = true;
            }
            RefreshSimulationPulldownAsynchron();
            return(yes);
        }
Exemple #9
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (Validated == false)
            {
                YesNoWindow win = new YesNoWindow()
                {
                    Text = "Are you sure you wish to cancel this ?", Validated = false
                };
                win.ShowCentered();

                if (!win.Validated)
                {
                    e.Cancel = true;
                }
            }
        }
Exemple #10
0
        private void MainWindow_OnClosing(object sender, CancelEventArgs e)
        {
            if (!MenuWindow.isSaved)
            {
                YesNoWindow message =
                    new YesNoWindow("Save Game", "Do you want to save your game?");
                message.Owner = GetWindow(this);
                message.ShowDialog();

                if (message.ClickedYes)
                {
                    SaveGame();
                }
            }
            closeMapWindow();
            CloseMenuWindow();
        }
Exemple #11
0
        private void MenuWindow_OnClosing(object sender, CancelEventArgs e)
        {
            isClosing = true;
            if (mainWindow != null && !isSaved)
            {
                YesNoWindow message =
                    new YesNoWindow("Save Game", "Do you want to save your game?");
                message.Owner = GetWindow(this);
                message.ShowDialog();

                if (message.ClickedYes)
                {
                    mainWindow.SaveGame();
                }
            }
            foreach (var window in Application.Current.Windows)
            {
                if (!(window is MenuWindow))
                {
                    ((Window)window).Close();
                }
            }
        }
Exemple #12
0
        public static void Show(string message, string warning)
        {
            YesNoWindow ya = new YesNoWindow(message, warning, true);

            ya.ShowDialog();
        }
Exemple #13
0
        public static void Show(string message)
        {
            YesNoWindow ya = new YesNoWindow(message, "Предупреждение", true);

            ya.ShowDialog();
        }
        /// <summary>
        /// Opens a serias of windows that ask the user for a password to open a config file
        /// </summary>
        /// <param name="OnReceive">Callback that executes once the config got loaded successfull. Contains a bool that says if the config has been created new (true) or if the config has been loaded and therewas existed (false). Contains a string that represents the config password, used to de/encrypt the config.</param>
        /// <param name="OnCancel">Callback that executes once the user cancels opening of the config</param>
        /// <returns>Null if the user cancled the config-request; otherwise the loaded or newly created config</returns>
        public static void GetConfigFromUser(Action <bool, Config, string> OnReceive, Action OnCancel)
        {
            log.Debug("Starting to request the config (From the user)");

            // Checks if a config file exists
            if (!File.Exists(PLCA.CONFIG_PATH))
            {
                log.Debug("Config does not exist, asking to create a new one.");

                // Creates a new window to ask the user for further instructions
                var askNew = new YesNoWindow(
                    Lang.config_notexisting_title,
                    OnCreateNewConfig,
                    OnCancel,
                    Lang.config_notexisting_yes,
                    Lang.config_notexisting_no,
                    Lang.config_notexisting_title,
                    Lang.config_notexisting_info
                    );

                // Opens the window
                askNew.ShowDialog();
                return;
            }

            // Creates the window to ask for the config-password
            var askPass = new TextinputWindow(
                Lang.config_pass_title,
                Lang.config_pass_title,
                OnReceivePassword,
                OnCancel,
                Lang.config_pass_ok,
                Lang.config_pass_cancle);

            // Opens the window
            askPass.ShowDialog();

            // Executes once the user has submitted a password
            void OnReceivePassword(string password)
            {
                try
                {
                    log
                    .Debug("Received password, creating new config.")
                    .Critical("Password="******"The previous config could be decrypted, but is currupted")
                    .Critical("Raw previous content=" + e.RawInput);

                    // The config could be decrypted but is currupted
                    // Creates a new window to ask the user for further instructions
                    var askNew = new YesNoWindow(
                        Lang.config_currupted_title,
                        OnCreateNewConfig,
                        OnCancel,
                        Lang.config_currupted_yes,
                        Lang.config_currupted_no,
                        Lang.config_currupted_title,
                        Lang.config_currupted_info,
                        () => Clipboard.SetText(e.RawInput),
                        Lang.config_currepted_copy
                        );

                    // Opens the window
                    askNew.ShowDialog();
                }
                catch (ConfigInvalidKeyException)
                {
                    log.Debug("User has specified an invalid password.");

                    // Creates a window to inform the user
                    var ackWin = new AcknowledgmentWindow(
                        Lang.config_wrongpw_title,
                        Lang.config_wrongpw_title,
                        () => GetConfigFromUser(OnReceive, OnCancel),
                        Lang.config_wrongpw_retry
                        );

                    // Opens the window
                    ackWin.ShowDialog();
                }
                catch (Exception e)
                {
                    log
                    .Debug("Unknown error occurred (Maybe a file error with permissions?)")
                    .Critical(e);

                    // Creates a window to inform the user
                    var ackWin = new AcknowledgmentWindow(
                        Lang.config_loaderr_title,
                        e.Message,
                        OnCancel,
                        Lang.config_loaderr_close
                        );

                    // Opens the window
                    ackWin.ShowDialog();
                }
            }

            // Executes once the user wants to create a new config (Because the old one got destroyed)
            void OnCreateNewConfig()
            {
                log.Debug("Asking for the password of the new config");

                // Asks for the new password
                var askPass2 = new TextinputWindow(
                    Lang.config_new_pass_title,
                    Lang.config_new_pass_text,
                    OnSubmitNewPassword,
                    OnCancel,
                    Lang.config_pass_ok,
                    Lang.config_pass_cancle
                    );

                // Shows the window
                askPass2.ShowDialog();
            }

            // Executes once the user has decided the new password
            void OnSubmitNewPassword(string password)
            {
                // Creates a config with the default parameters
                Config cfg = new Config
                {
                    Host       = string.Empty,
                    Port       = 0,
                    PrivateKey = new RSAParameters()
                    {
                        D        = new byte[0],
                        DP       = new byte[0],
                        DQ       = new byte[0],
                        Exponent = new byte[0],
                        InverseQ = new byte[0],
                        Modulus  = new byte[0],
                        P        = new byte[0],
                        Q        = new byte[0]
                    }
                };

                try
                {
                    log
                    .Debug("Saving new config")
                    .Critical("New Password="******"Successfully saved the new config");

                    // Returns the new config
                    OnReceive(true, cfg, password);
                }
                catch (Exception e)
                {
                    log
                    .Debug("Error saving the new config. Maybe a file-error with permissions?")
                    .Critical(e);

                    // Creates the warning window
                    var ackWin = new AcknowledgmentWindow(
                        Lang.config_new_error,
                        e.Message,
                        OnCancel,
                        Lang.config_new_error_button
                        );

                    // Opens the new window
                    ackWin.ShowDialog();
                }
            }
        }