private void _buttonCancel_Click(object sender, EventArgs e) { _buttonCancel.Enabled = false; _buttonGenerate.Enabled = true; if (_generator != null) { _generator.Cancel(); _generator = null; } }
private void _buttonGenerate_Click(object sender, EventArgs e) { int totalStudies; int studiesPerDay; if (!int.TryParse(_textBoxTotalStudies.Text, out totalStudies)) { totalStudies = 50000; } if (!int.TryParse(_textBoxStudiesPerDay.Text, out studiesPerDay)) { studiesPerDay = 1800; } if (_checkBoxImageServerDatabase.Checked) { if (_comboBoxServerPartition.SelectedItem == null) { return; } ServerPartition selectedPartition = _comboBoxServerPartition.SelectedItem as ServerPartition; if (selectedPartition == null) { return; } _generator = new ImageServerDbGenerator(selectedPartition, _dateTimePickerStart.Value, totalStudies, studiesPerDay, (int)_numericUpDownPercentWeekend.Value); } else { _generator = new ImageServerDbGenerator(_textBoxRemoteAETitle.Text, _textBoxHost.Text, int.Parse(_textBoxPort.Text), _dateTimePickerStart.Value, totalStudies, studiesPerDay, (int)_numericUpDownPercentWeekend.Value); } _progressBar.Maximum = 0; _progressBar.Maximum = 100; _generator.RegisterProgressUpated(ProgressUpdated); if (_checkBoxMR.Checked) { _generator.AddSopGenerator(new MrSopGenerator(_hospital1)); _generator.AddSopGenerator(new MrSopGenerator(_hospital2)); _generator.AddSopGenerator(new MrSopGenerator(_hospital3)); } if (_checkBoxCT.Checked) { _generator.AddSopGenerator(new CtSopGenerator(_hospital1)); _generator.AddSopGenerator(new CtSopGenerator(_hospital4)); _generator.AddSopGenerator(new CtSopGenerator(_hospital3)); } if (_checkBoxCR.Checked) { _generator.AddSopGenerator(new CrSopGenerator(_hospital1)); _generator.AddSopGenerator(new CrSopGenerator(_hospital3)); } if (_checkBoxDX.Checked) { _generator.AddSopGenerator(new DxSopGenerator(_hospital1)); _generator.AddSopGenerator(new DxSopGenerator(_hospital4)); } if (_checkBoxRF.Checked) { _generator.AddSopGenerator(new RfSopGenerator(_hospital2)); } if (_checkBoxXA.Checked) { _generator.AddSopGenerator(new XaSopGenerator(_hospital1)); } if (_checkBoxMG.Checked) { _generator.AddSopGenerator(new MgSopGenerator(_hospital1)); _generator.AddSopGenerator(new MgSopGenerator(_hospital2)); } if (_checkBoxUS.Checked) { _generator.AddSopGenerator(new UsSopGenerator(_hospital1)); _generator.AddSopGenerator(new UsSopGenerator(_hospital4)); _generator.AddSopGenerator(new UsSopGenerator(_hospital3)); } _buttonCancel.Enabled = true; _buttonGenerate.Enabled = false; _generator.Start(); }
private void _buttonGenerate_Click(object sender, EventArgs e) { int totalStudies; int studiesPerDay; if (!int.TryParse(_textBoxTotalStudies.Text, out totalStudies)) totalStudies = 50000; if (!int.TryParse(_textBoxStudiesPerDay.Text, out studiesPerDay)) studiesPerDay = 1800; if (_checkBoxImageServerDatabase.Checked) { if (_comboBoxServerPartition.SelectedItem == null) return; ServerPartition selectedPartition = _comboBoxServerPartition.SelectedItem as ServerPartition; if (selectedPartition == null) return; _generator = new ImageServerDbGenerator(selectedPartition, _dateTimePickerStart.Value, totalStudies, studiesPerDay, (int) _numericUpDownPercentWeekend.Value); } else { _generator = new ImageServerDbGenerator(_textBoxRemoteAETitle.Text, _textBoxHost.Text, int.Parse(_textBoxPort.Text), _dateTimePickerStart.Value, totalStudies, studiesPerDay, (int) _numericUpDownPercentWeekend.Value); } _progressBar.Maximum = 0; _progressBar.Maximum = 100; _generator.RegisterProgressUpated(ProgressUpdated); if (_checkBoxMR.Checked) { _generator.AddSopGenerator(new MrSopGenerator(_hospital1)); _generator.AddSopGenerator(new MrSopGenerator(_hospital2)); _generator.AddSopGenerator(new MrSopGenerator(_hospital3)); } if (_checkBoxCT.Checked) { _generator.AddSopGenerator(new CtSopGenerator(_hospital1)); _generator.AddSopGenerator(new CtSopGenerator(_hospital4)); _generator.AddSopGenerator(new CtSopGenerator(_hospital3)); } if (_checkBoxCR.Checked) { _generator.AddSopGenerator(new CrSopGenerator(_hospital1)); _generator.AddSopGenerator(new CrSopGenerator(_hospital3)); } if (_checkBoxDX.Checked) { _generator.AddSopGenerator(new DxSopGenerator(_hospital1)); _generator.AddSopGenerator(new DxSopGenerator(_hospital4)); } if (_checkBoxRF.Checked) { _generator.AddSopGenerator(new RfSopGenerator(_hospital2)); } if (_checkBoxXA.Checked) { _generator.AddSopGenerator(new XaSopGenerator(_hospital1)); } if (_checkBoxMG.Checked) { _generator.AddSopGenerator(new MgSopGenerator(_hospital1)); _generator.AddSopGenerator(new MgSopGenerator(_hospital2)); } if (_checkBoxUS.Checked) { _generator.AddSopGenerator(new UsSopGenerator(_hospital1)); _generator.AddSopGenerator(new UsSopGenerator(_hospital4)); _generator.AddSopGenerator(new UsSopGenerator(_hospital3)); } _buttonCancel.Enabled = true; _buttonGenerate.Enabled = false; _generator.Start(); }