Ejemplo n.º 1
0
 /// <inheritdoc />
 public Form1()
 {
     InitializeComponent();
     tbxTightTol.Text      = TightTol.ToString();
     tbxMainTol.Text       = MainTol.ToString();
     tbxThreshholdTol.Text = Threshold.ToString();
     tbxSourceLabel.Text   = SourceAliasName.ToString();
     tbxTargetLabel.Text   = TargetAliasName.ToString();
     _dataHandler          = new DscDataHandler();
     tested = false;
     worker = new BackgroundWorker
     {
         WorkerReportsProgress = true, WorkerSupportsCancellation = true
     };
     worker.DoWork             += Worker_DoWork;
     worker.ProgressChanged    += Worker_ProgressChanged;
     worker.RunWorkerCompleted += WorkerRunWorkerCompleted;
     _isRunning = false;
 }
Ejemplo n.º 2
0
        private void TestDirectories_Click(object sender, EventArgs e)
        {
            try
            {
                SaveDirectory = tbxSaveDir.Text;
                if (!Directory.Exists(SaveDirectory))
                {
                    SaveDirectory = null;
                }
                tbxSaveDir.Text = SaveDirectory;

                TargetDirectory = tbxTarget.Text;
                if (!Directory.Exists(TargetDirectory))
                {
                    TargetDirectory = null;
                }
                tbxTarget.Text           = TargetDirectory;
                lblTargetFilesFound.Text = _dataHandler.CreateTargetList(TargetDirectory).ToString();

                SourceDirectory = tbxSource.Text;
                if (!Directory.Exists(SourceDirectory))
                {
                    SourceDirectory = null;
                }
                tbxSource.Text           = SourceDirectory;
                lblSourceFilesFound.Text = _dataHandler.CreateSourceList(SourceDirectory).ToString();
            }
            catch (ArgumentNullException)
            {
                _ = System.Windows.Forms.MessageBox.Show("One of the directory fields is either empty or invalid");
                return;
            }

            try
            {
                TightTol         = float.Parse(tbxTightTol.Text);
                TightTol         = Math.Abs(TightTol);
                tbxTightTol.Text = TightTol.ToString();

                MainTol         = float.Parse(tbxMainTol.Text);
                MainTol         = Math.Abs(MainTol);
                tbxMainTol.Text = MainTol.ToString();

                if (TightTol > MainTol)
                {
                    _ = System.Windows.Forms.MessageBox.Show("Your tight tolerance is greater than your main tolerance. This does not make sense");
                    return;
                }

                Threshold             = float.Parse(tbxThreshholdTol.Text);
                Threshold             = Math.Abs(Threshold);
                tbxThreshholdTol.Text = Threshold.ToString();
            }
            catch (FormatException)
            {
                _ = System.Windows.Forms.MessageBox.Show("Please enter a floating point number above zero");
                return;
            }
            catch (ArgumentNullException)
            {
                _ = System.Windows.Forms.MessageBox.Show("One of the tolerance fields is either empty or invalid");
                return;
            }
            tested = true;
        }