/// <summary> /// Called when the make manager button is clicked /// </summary> /// <param name="sender">autogenerated</param> /// <param name="e">autogenerated</param> private void MakeManagerButtonClick(object sender, RoutedEventArgs e) { var d = new CheckMasterPasswordDialog(_ui); d.ShowDialog(); if (d.DialogResult.HasValue && d.DialogResult == true) { if (ManagerstationGrid.SelectedItem != null && _ui.MakeManager(new IPEndPoint(IPAddress.Parse(((StationStatus)ManagerstationGrid.SelectedItem).IpAdress), 62000))) { if (d.IsCancel) { return; } if (_activeUpdateThread != null) { _activeUpdateThread.Abort(); } var wnd = (StationWindow)Window.GetWindow(_parent); if (wnd != null) { wnd.Width = 600; } _ui.ManagerOverviewPage = null; _parent.Navigate(new BallotRequestPage(_ui, _parent)); } else { if (d.IsCancel) { return; } MessageBox.Show("Der kunne ikke forbindes til den valgte station", "Ingen forbindelse", MessageBoxButton.OK); } } else { MessageBox.Show("Det kodeord du indtastede er ikke korrekt, prøv igen", "Forkert Master Kodeord", MessageBoxButton.OK, MessageBoxImage.Stop); } }
/// <summary> /// Called when the make manager button is clicked /// </summary> /// <param name="sender"> /// autogenerated /// </param> /// <param name="e"> /// autogenerated /// </param> private void MakeManagerButtonClick(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 promote a check-in station to a manager."); d.Owner = _ui._stationWindow; result = (Boolean)d.ShowDialog(); cancel = d.IsCancel; })); if (cancel) { return; } if (result) { if (ManagerstationGrid.SelectedItem != null && _ui.MakeManager(((StationStatus)ManagerstationGrid.SelectedItem).Address)) { } else { FlexibleMessageBox.Show(_ui._stationNativeWindow, "Could not connect to the specified station", "No Connection", MessageBoxButtons.OK); } } else { FlexibleMessageBox.Show(_ui._stationNativeWindow, "You have entered an incorrect master password, please try again.", "Incorrect Master Password", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }