コード例 #1
0
 private void buttonImportFromLibrary_Click(object sender, EventArgs e)
 {
     if (comboBoxImport.SelectedIndex == 0)
     {
         using (var dialog = new CurveLibraryDialog()) {
             if (dialog.ShowDialog() != DialogResult.OK)
             {
                 return;
             }
             if (comboBoxChannels != null)
             {
                 ((Channel)comboBoxChannels.SelectedItem).DimmingCurve = _points = dialog.SelectedCurve;
             }
             RedrawBoth();
         }
     }
     else
     {
         using (var dialog2 = new CurveFileImportExportDialog(CurveFileImportExportDialog.ImportExport.Import)) {
             if (dialog2.ShowDialog() != DialogResult.OK)
             {
                 return;
             }
             var selectedCurve = dialog2.SelectedCurve;
             if (selectedCurve == null)
             {
                 return;
             }
             var channel = comboBoxChannels.SelectedItem as Channel;
             if (channel != null)
             {
                 channel.DimmingCurve = _points = selectedCurve.CurveData;
             }
             RedrawBoth();
         }
     }
 }
コード例 #2
0
ファイル: DimmingCurveDialog.cs プロジェクト: jmcadams/vplus
 private void buttonImportFromLibrary_Click(object sender, EventArgs e)
 {
     if (comboBoxImport.SelectedIndex == 0) {
         using (var dialog = new CurveLibraryDialog()) {
             if (dialog.ShowDialog() != DialogResult.OK) {
                 return;
             }
             if (comboBoxChannels != null) {
                 ((Channel) comboBoxChannels.SelectedItem).DimmingCurve = _points = dialog.SelectedCurve;
             }
             RedrawBoth();
         }
     }
     else {
         using (var dialog2 = new CurveFileImportExportDialog(CurveFileImportExportDialog.ImportExport.Import)) {
             if (dialog2.ShowDialog() != DialogResult.OK) {
                 return;
             }
             var selectedCurve = dialog2.SelectedCurve;
             if (selectedCurve == null) {
                 return;
             }
             var channel = comboBoxChannels.SelectedItem as Channel;
             if (channel != null) {
                 channel.DimmingCurve = _points = selectedCurve.CurveData;
             }
             RedrawBoth();
         }
     }
 }