/// <summary> /// Called when the end election button is clicked /// </summary> /// <param name="sender">autogenerated</param> /// <param name="e">autogenerated</param> private void EndElectionButtonClick(object sender, RoutedEventArgs e) { var d = new CheckMasterPasswordDialog(_ui); d.ShowDialog(); if (d.DialogResult.HasValue && d.DialogResult == true) { if (d.IsCancel != true) { if (_activeUpdateThread != null) { _activeUpdateThread.Abort(); } _ui.AnnounceEndElection(); _ui.ManagerOverviewPage = null; _parent.Navigate(new EndedElectionPage(_parent, _ui)); } } else { MessageBox.Show("Det kodeord du indtastede er ikke korret, prøv igen", "Forkert Master Kodeord", MessageBoxButton.OK); } }
/// <summary> /// Called when the end election button is clicked /// </summary> /// <param name="sender"> /// autogenerated /// </param> /// <param name="e"> /// autogenerated /// </param> private void EndElectionButtonClick(object sender, RoutedEventArgs e) { Boolean result = false; Boolean cancel = false; _ui._stationWindow.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, new Action( delegate { var d = new CheckMasterPasswordDialog(_ui, "The master password is required to end the election."); d.Owner = _ui._stationWindow; result = (Boolean)d.ShowDialog(); cancel = d.IsCancel; })); if (cancel) { return; } if (result) { if (_activeUpdateThread != null) { _activeUpdateThread.Abort(); } _ui.AnnounceEndElection(); _ui.ManagerOverviewPage = null; _parent.Navigate(new EndedElectionPage(_parent, _ui)); } else { FlexibleMessageBox.Show(_ui._stationNativeWindow, "You have entered an incorrect master password, please try again.", "Incorrect Master Password", MessageBoxButtons.OK); } }