// Functionality
        private void StartProgress()
        {
            setButtonsToUploading();
            pb_upload.Visibility = Visibility.Visible;
            txt_output.Text      = "";


            // Check for password
            EncryptionPassword = Ini.read(Ini.KEY_ENCRYPTION_PASSWORD);

            if (String.IsNullOrWhiteSpace(EncryptionPassword))
            {
                MaterialDialog dialogAskPassword = new MaterialDialog("Set a password");
                dialogAskPassword.setInput();
                dialogAskPassword.setButtonPositive();
                dialogAskPassword.setButtonNeutral();

                MaterialDialogResult result = dialogAskPassword.ShowReturnResult();

                if (String.IsNullOrWhiteSpace(result.TextInput) || result.ButtonId != MaterialDialog.BUTTON_ID.POSITIVE)
                {
                    new MaterialDialog("Error", "You have to set a password in order to continue.").ShowDialog();
                    setButtonsToStandard();
                    return;
                }
                EncryptionPassword = result.TextInput;
                Ini.write(Ini.KEY_ENCRYPTION_PASSWORD, EncryptionPassword);
            }

            if (workerPublishUpdate != null)
            {
                if (workerPublishUpdate.IsBusy)
                {
                    new MaterialDialog("Error", "Please wait for the current operation to finish ...").ShowDialog();
                    return;
                }
            }

            workerPublishUpdate = new BackgroundWorker();

            workerPublishUpdate.DoWork += new DoWorkEventHandler((senderRepair, eRepair) => workerUpdate(senderRepair, eRepair));

            workerPublishUpdate.ProgressChanged           += new ProgressChangedEventHandler(workerProgressChanged);
            workerPublishUpdate.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(workerUpdateCompleted);
            workerPublishUpdate.WorkerReportsProgress      = true;
            workerPublishUpdate.WorkerSupportsCancellation = true;

            workerPublishUpdate.RunWorkerAsync();
        }
예제 #2
0
        public MaterialDialogResult ShowReturnResult()
        {
            ShowDialog();

            MaterialDialogResult result = new MaterialDialogResult();

            result.ButtonId = ClickedButton;

            if (HasInputField)
            {
                result.TextInput = tb_inputtext.Text;
            }

            return(result);
        }
예제 #3
0
        private void askFinalGameName()
        {
            // Ask for the filename before starting the progress
            Application.Current.Dispatcher.Invoke(new Action(() => {
                MaterialDialog dialog = new MaterialDialog("Choose a filename");
                dialog.setInput();
                dialog.setButtonPositive();
                dialog.setButtonNeutral();

                MaterialDialogResult result = dialog.ShowReturnResult();

                if (String.IsNullOrWhiteSpace(result.TextInput) || result.ButtonId != MaterialDialog.BUTTON_ID.POSITIVE)
                {
                    new MaterialDialog("Error", "You have to set a password in order to continue.").ShowDialog();
                    setButtonsToStandard();
                    workerPublishUpdate.CancelAsync();
                    return;
                }
                FinalGameName = result.TextInput;
            }));
        }