Exemple #1
0
        private bool CheckMasterPasswordForQuit()
        {
            if (_ui._station != null)
            {
                var d = new CheckMasterPasswordDialog(_ui, "The master password is required to shut down this station.");
                d.Owner = this;
                d.ShowDialog();

                if (d.IsCancel)
                {
                    return(false);
                }
                else if (d.DialogResult.HasValue &&
                         d.DialogResult == true)
                {
                    _ui.CloseStation();
                    Environment.Exit(0);
                }
                else
                {
                    FlexibleMessageBox.Show(_ui._stationNativeWindow,
                                            "Master password entered incorrctly, please try again.", "Incorrect Master Password", MessageBoxButtons.OK);
                    return(false);
                }
            }
            else
            {
                Environment.Exit(0);
            }
            return(true);
        }
        /// <summary>
        /// Called whn File -> Export data is clicked
        /// </summary>
        /// <param name="sender">auto generated</param>
        /// <param name="e">auto generated</param>
        private void ExportDataClick(object sender, RoutedEventArgs e)
        {
            var d = new CheckMasterPasswordDialog(_ui);

            d.ShowDialog();

            if (d.DialogResult.HasValue && d.DialogResult == true)
            {
                if (d.IsCancel)
                {
                    return;
                }

                var saveDialog = new SaveFileDialog {
                    Title = "Eksporter Valg Data"
                };
                saveDialog.Filter = "Data files (*.data)|*.data|All files (*.*)|*.*";
                saveDialog.ShowDialog();
                if (!saveDialog.FileName.Equals(""))
                {
                    _ui.ExportData(saveDialog.FileName);
                }
            }
            else
            {
                MessageBox.Show("Det kodeord du indtastede er ikke korrekt, prøv igen", "Forkert Master Kodeord", MessageBoxButton.OK);
            }
        }
        /// <summary>
        /// Called when the Done button is clicked
        /// </summary>
        /// <param name="sender">auto generated</param>
        /// <param name="e">auto generated</param>
        private void DoneButtonClick(object sender, RoutedEventArgs e)
        {
            var d = new CheckMasterPasswordDialog(_ui);

            d.ShowDialog();

            if (d.DialogResult.HasValue && d.DialogResult == true)
            {
                if (d.IsCancel)
                {
                    return;
                }

                if (!CPRTextbox.Text.Equals(""))
                {
                    WaitingLabel.Content   = "Venter på svar...";
                    doneButton.IsEnabled   = false;
                    CancelButton.IsEnabled = false;
                    _ui.RequestBallotOnlyCPR(CPRTextbox.Text, d.TypedPassword);
                }
            }
            else
            {
                MessageBox.Show("Det kodeord du indtastede er ikke korret, prøv igen", "Forkert Master Kodeord", MessageBoxButton.OK);
            }
        }
        /// <summary>
        /// Called when File -> Exit is clicked
        /// </summary>
        /// <param name="sender">auto generated</param>
        /// <param name="e">auto generated</param>
        private void ExitClick(object sender, RoutedEventArgs e)
        {
            var d = new CheckMasterPasswordDialog(_ui);

            d.ShowDialog();

            if (d.DialogResult.HasValue && d.DialogResult == true)
            {
                if (d.IsCancel)
                {
                    return;
                }

                Environment.Exit(0);
            }
            else
            {
                MessageBox.Show("Det kodeord du indtastede er ikke korret, prøv igen", "Forkert Master Kodeord", MessageBoxButton.OK);
            }
        }
Exemple #5
0
        /// <summary>
        /// Called whn File -&gt; Export data is clicked
        /// </summary>
        /// <param name="sender">
        /// auto generated
        /// </param>
        /// <param name="e">
        /// auto generated
        /// </param>
        private void ExportDataClick(object sender, RoutedEventArgs e)
        {
            if (_ui._station == null)
            {
                FlexibleMessageBox.Show(_ui._stationNativeWindow, "There is no election data to report.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            var d = new CheckMasterPasswordDialog(_ui, "The master password is required to export election data.");

            d.Owner = this;
            d.ShowDialog();

            if (d.DialogResult.HasValue &&
                d.DialogResult == true)
            {
                if (d.IsCancel)
                {
                    return;
                }

                var saveDialog = new Microsoft.Win32.SaveFileDialog {
                    Title = "Generate Reports"
                };
                saveDialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
                saveDialog.ShowDialog();
                if (!saveDialog.FileName.Equals(string.Empty))
                {
                    _ui.ExportData(saveDialog.FileName);
                }
                System.Diagnostics.Process.Start(saveDialog.FileName);
            }
            else
            {
                FlexibleMessageBox.Show(_ui._stationNativeWindow,
                                        "Master password entered incorrectly, please try again.", "Incorrect Master Password", MessageBoxButtons.OK);
            }
        }