protected override string AcquireNewFile() { try { if (scanner.CanScan()) { ScanningForm form = new ScanningForm(scanner); DialogResult res = form.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { return(form.FilePath); } else { return(""); } } else { Error("لا توجد ماسحات متصلة"); return(""); } } catch { return(""); } }
private void ScanningSettingsForm_Load(object sender, EventArgs e) { try { if (!manager.CanScan()) { throw new Exception(); } List <string> allDevices = manager.GetDevices(); if (allDevices.Count > 0) { int defaultIndex = Library.ConfigurationManager.ScanningDeviceIndex; foreach (string s in allDevices) { comboBox1.Items.Add(s); } if (defaultIndex < allDevices.Count) { comboBox1.SelectedIndex = defaultIndex; } else { comboBox1.SelectedIndex = 0; } } } catch { Error("لا توجد ماسحات متصلة"); Close(); } }