public PrinterSettingsForm(DicomPrintConfig config) { InitializeComponent(); this._config = config; this.AETITLE_txt.Text = this._config.AETitle; this.printerName_txt.Text = this._config.PrinterName; this.tray.Items.Clear(); this.tray.Items.Add("Driver Select"); this.resolutionBar.Value = config.resolution; this.numericUpDown1.Value = config.m_top; this.numericUpDown2.Value = config.m_left; this.numericUpDown3.Value = config.m_bottom; this.numericUpDown4.Value = config.m_right; foreach (PaperSource source in this._config.PrinterSettings.PaperSources) { if (!string.IsNullOrEmpty(source.SourceName)) { this.tray.Items.Add(source.SourceName); } } this.tray.SelectedItem = this._config.PaperSource; if (this.tray.SelectedIndex == -1) { this.tray.SelectedIndex = 0; } this.cbPreviewOnly.Checked = this._config.PreviewOnly; }
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { DicomPrintConfig config = new DicomPrintConfig(); if (new PrinterSettingsForm(config).ShowDialog(this) == DialogResult.OK) { Config_.Instance.Printers.Add(config); save(); } } }
public DicomPrintConfig FindPrinter(string aeTitle) { using (List <DicomPrintConfig> .Enumerator enumerator = this.Printers.GetEnumerator()) { while (true) { if (!enumerator.MoveNext()) { break; } DicomPrintConfig current = enumerator.Current; if (current.AETitle == aeTitle) { return(current); } } } return(null); }
private void lvPrinters_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { DicomPrintConfig config = new DicomPrintConfig(); if (new PrinterSettingsForm(config).ShowDialog(this) == DialogResult.OK) { Config_.Instance.Printers.Add(config); save(); } } if (e.KeyCode == Keys.Delete) { if ((this.Printers_List.SelectedItems.Count != 0) && (MessageBox.Show(this, "Are you sure you want to delete this?", "Delete Printer", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.No)) { DicomPrintConfig tag = (DicomPrintConfig)this.Printers_List.SelectedItems[0].Tag; Config_.Instance.Printers.Remove(tag); save(); } } }