コード例 #1
0
        /// <summary>Presents the result of the configuration for the user.</summary>
        /// <param name="result">Result of the process.</param>
        private void ConfigCompleted(bool result)
        {
            Dispatcher.BeginInvoke((Action)async delegate
            {
                progDialog.Close();
                progDialog = null;
                if (result)                                                                                                         // Show a message that the process was successful
                {
                    lb_configConfirmation.Content    = "Indstillingerne er gemt";
                    lb_configConfirmation.Visibility = System.Windows.Visibility.Visible;
                    lb_configConfirmation.Foreground = Brushes.Green;
                }
                else
                {                                                                                                                   // Open a window for the user to try again
                    if (infoDlg == null)
                    {
                        infoDlg = new InfoAndErrorWindow("Fejlmeddelelse", "Indstillingerne kunne ikke gemmes", "Forsøg igen", "Annuller");
                        infoDlg.OnDialogFinished += infoDlg_DialogFinished;
                        infoDlg.OnDialogFinished -= handleConfig;
                        infoDlg.OnDialogFinished += handleConfig;
                        infoDlg.Owner             = this;
                        infoDlg.ShowDialog();
                    }
                }

                await Task.Delay(2000);
                lb_configConfirmation.Visibility = System.Windows.Visibility.Hidden;                                                // Hide the message again
            });
        }
コード例 #2
0
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        // Universal Robot connection handler
        /// <summary>Opens a window showing the error.</summary>
        /// <param name="error">Error message.</param>
        private void ConnectionLostUR(string error)
        {
            Dispatcher.BeginInvoke((Action) delegate
            {
                if (progDialog != null)
                {
                    if (progDialog.IsActive)
                    {
                        progDialog.Close();                                                                             // If the progressbar is active from a previous attempt it will be closed
                        progDialog = null;
                    }
                }

                if (infoDlg == null)
                {
                    infoDlg = new InfoAndErrorWindow("Fejlmeddelelse", error, "Forsøg igen", "Annuller");
                    infoDlg.OnDialogFinished -= infoDlg_DialogFinished;
                    infoDlg.OnDialogFinished += infoDlg_DialogFinished;
                    infoDlg.OnDialogFinished -= handleUR;
                    infoDlg.OnDialogFinished += handleUR;
                    infoDlg.Owner             = this;
                    infoDlg.ShowDialog();
                }
            });
        }
コード例 #3
0
 /// <summary>Opens a new window to show the error message to the user.</summary>
 private void ShowException(string error, string source)
 {
     Dispatcher.BeginInvoke((Action) delegate
     {
         infoDlg = new InfoAndErrorWindow("Fejlmeddelelse", error, "OK");
         infoDlg.OnDialogFinished -= infoDlg_DialogFinished;
         infoDlg.OnDialogFinished += infoDlg_DialogFinished;
         infoDlg.Owner             = this;
         infoDlg.ShowDialog();
     });
 }
コード例 #4
0
 /// <summary>Establish connection event. Opens a window for the user to confirm the establishment.</summary>
 private void btn_establishConnection_Click(object sender, RoutedEventArgs e)
 {
     if (infoDlg == null)
     {
         infoDlg = new InfoAndErrorWindow("Bekræftigelse", "Vil du oprette forbindelse til " + lb_units.SelectedItem.ToString() + "?", "Ok", "Annuller");
         infoDlg.OnDialogFinished -= handleConnection;
         infoDlg.OnDialogFinished += handleConnection;
         infoDlg.Owner             = this;
         infoDlg.ShowDialog();
     }
 }
コード例 #5
0
 /// <summary>Opens a window showing the error.</summary>
 /// <param name="error">Error message.</param>
 private void ConnectionLostVF(string error)
 {
     Dispatcher.BeginInvoke((Action) delegate
     {
         if (infoDlg == null)
         {
             infoDlg = new InfoAndErrorWindow("Fejlmeddelelse", error, "Forsøg igen", "Annuller");
             infoDlg.OnDialogFinished -= infoDlg_DialogFinished;
             infoDlg.OnDialogFinished += infoDlg_DialogFinished;
             infoDlg.OnDialogFinished -= handleVF;
             infoDlg.OnDialogFinished += handleVF;
             infoDlg.Owner             = this;
             infoDlg.ShowDialog();
         }
     });
 }
コード例 #6
0
        /// <summary>Open a new window to present the error to the user.</summary>
        /// <param name="error">Error message</param>
        /// <param name="source">Source of the error</param>
        private void ShowException(string error, string source)
        {
            Dispatcher.BeginInvoke((Action) delegate
            {
                if (infoDlg != null)
                {
                    infoDlg.Close();
                    infoDlg = null;
                }

                progDialog.Close();
                this.IsEnabled = true;

                if (errorDlg == null)
                {
                    errorDlg = new InfoAndErrorWindow("Fejlmeddelelse", "Der kunne ikke oprettes forbindelse til " + source, "Ok");
                    errorDlg.OnDialogFinished -= infoDlg_Error_DialogFinished;
                    errorDlg.OnDialogFinished += infoDlg_Error_DialogFinished;
                    errorDlg.Owner             = this;
                    errorDlg.ShowDialog();
                }
            });
        }