Beispiel #1
0
 /// <summary>
 /// Called when this station is promoted
 /// </summary>
 public void BecomeManager()
 {
     _ui.BallotRequestPage = null;
     _parent.Navigate(new ManagerOverviewPage(_parent, _ui));
     if (_ui.EnoughStations())
     {
         _ui.EnoughPeers();
     }
     else
     {
         _ui.NotEnoughPeers();
     }
 }
Beispiel #2
0
        /// <summary>
        /// Called when the start election button is clicked
        /// </summary>
        /// <param name="sender">
        /// autogenerated
        /// </param>
        /// <param name="e">
        /// autogenerated
        /// </param>
        private void StartEndElectionButtonClick(object sender, RoutedEventArgs e)
        {
            if (!_ui.EnoughStations())
            {
                FlexibleMessageBox.Show(_ui._stationNativeWindow,
                                        "You are not connected to enough stations to start the election.",
                                        "Not Enough Stations",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                return;
            }

            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 start the election.");
                d.Owner = _ui._stationWindow;
                result  = (Boolean)d.ShowDialog();
                cancel  = d.IsCancel;
            }));

            if (result)
            {
                if (cancel)
                {
                    return;
                }

                if (_activeUpdateThread != null)
                {
                    _activeUpdateThread.Abort();
                }

                _ui.OverviewPage = null;
                _ui.ManagerAnnounceStartElection();
                _parent.Navigate(new ManagerOverviewPage(_parent, _ui));
            }
            else
            {
                FlexibleMessageBox.Show(_ui._stationNativeWindow,
                                        "Incorrect master password, please try again.", "Incorrect Master Password", MessageBoxButtons.OK);
            }
        }
        /// <summary>
        /// Called when the start election button is clicked
        /// </summary>
        /// <param name="sender">autogenerated</param>
        /// <param name="e">autogenerated</param>
        private void StartEndElectionButtonClick(object sender, RoutedEventArgs e)
        {
            if (!_ui.EnoughStations())
            {
                MessageBox.Show("Du er ikke forbundet til nok stationer", "Ikke nok stationer", MessageBoxButton.OK,
                                MessageBoxImage.Information);
                return;
            }


            var d = new CheckMasterPasswordDialog(_ui);

            d.ShowDialog();

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

                if (_activeUpdateThread != null)
                {
                    _activeUpdateThread.Abort();
                }


                _ui.OverviewPage = null;
                _ui.ManagerAnnounceStartElection();
                _parent.Navigate(new ManagerOverviewPage(_parent, _ui));
            }
            else
            {
                MessageBox.Show("Det kodeord du indtastede er ikke korrekt, prøv igen", "Forkert master kodeord", MessageBoxButton.OK);
            }
        }