/// <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);
            }
        }
Esempio n. 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 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 Only CPR button is clicked
        /// </summary>
        /// <param name="sender">autogenerated</param>
        /// <param name="e">autogenerated</param>
        private void OnlyCprButtonClick(object sender, RoutedEventArgs e)
        {
            var d = new CheckMasterPasswordDialog(_ui);

            d.ShowDialog();

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

                _ui.RequestBallotOnlyCPR(CPRNumberTextbox.Text, d.TypedPassword);
            }
            else
            {
                MessageBox.Show("Det kodeord du indtastede er ikke korret, prøv igen", "Forkert Master Kodeord", MessageBoxButton.OK);
            }
        }
Esempio n. 5
0
        /// <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);
            }
        }
        /// <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);
            }
        }