Ejemplo n.º 1
0
 private void ScannersLauncher(ScannerSettings scannerSettings, PopupNotifierSettings popupNotifierSettings, ApplicationMode applicationMode)
 {
     try
     {
         scanners.ForEach(scanner => Task.Factory.StartNew(() =>
         {
             scanner.ApplySettings(scannerSettings, popupNotifierSettings);
             scanner.StartStopWorker(applicationMode == ApplicationMode.Scanning);
         }));
     }
     catch (Exception)
     {
         // write exception into the log.
     }
 }
Ejemplo n.º 2
0
        private void StartScanning_Click(object sender, EventArgs e)
        {
            scanResultsGridView.Refresh();
            // global popup settings (should be UI setted)
            PopupNotifierSettings popupSettings = new PopupNotifierSettings
            {
                Size = 15
            };

            // global scanner settings (UI setted)
            ScannerSettings scannerSettings = new ScannerSettings
            {
                AllowScannChange  = changedBox.Checked,
                AllowScannCreate  = createdBox.Checked,
                AllowScannDelete  = deletedBox.Checked,
                AllowScannRenamed = renamedBox.Checked
            };

            // App running settings
            if (applicationMode == ApplicationMode.Stopped)
            {
                applicationMode    = ApplicationMode.Scanning;
                startScanning.Text = "Stop";
                changedBox.Enabled = false;
                createdBox.Enabled = false;
                deletedBox.Enabled = false;
                renamedBox.Enabled = false;
            }
            else
            {
                applicationMode    = ApplicationMode.Stopped;
                startScanning.Text = "Start";
                changedBox.Enabled = true;
                createdBox.Enabled = true;
                deletedBox.Enabled = true;
                renamedBox.Enabled = true;
            }

            ScannersLauncher(scannerSettings, popupSettings, applicationMode);
        }