Changeset 9973 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs
- Timestamp:
- 09/16/13 18:52:52 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs
r9456 r9973 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.ComponentModel; 24 25 using System.Drawing; 25 26 using System.Linq; … … 30 31 using HeuristicLab.Optimization; 31 32 using HeuristicLab.Optimization.Views; 33 using HeuristicLab.PluginInfrastructure; 32 34 33 35 namespace HeuristicLab.Problems.DataAnalysis.Views { 36 34 37 [View("DataAnalysisSolution View")] 35 38 [Content(typeof(DataAnalysisSolution), false)] 36 public partial class DataAnalysisSolutionView : NamedItemCollectionView<IResult>{39 public partial class DataAnalysisSolutionView : Bla { 37 40 public DataAnalysisSolutionView() { 38 41 InitializeComponent(); … … 49 52 addButton.Enabled = false; 50 53 removeButton.Enabled = false; 54 if (Content == null) { 55 exportButton.Enabled = false; 56 } else { 57 exportButton.Enabled = !Locked; 58 } 51 59 } 52 60 … … 117 125 } else 118 126 base.itemsListView_SelectedIndexChanged(sender, e); 127 } 128 129 130 private void exportButton_Click(object sender, EventArgs e) { 131 var exporters = ApplicationManager.Manager.GetInstances<IDataAnalysisSolutionExporter>() 132 .Where(exporter => exporter.Supports(Content)).ToArray(); 133 exportFileDialog.Filter = exporters.Skip(1) 134 .Aggregate(exporters.First().FileTypeFilter, (s, exporter) => s + "|" + exporter.FileTypeFilter); 135 var result = exportFileDialog.ShowDialog(); 136 if (result == DialogResult.OK) { 137 138 var name = exportFileDialog.FileName; 139 var selectedExporter = exporters.Single(exporter => exporter.FileTypeFilter == exportFileDialog.Filter); 140 141 using (BackgroundWorker bg = new BackgroundWorker()) { 142 MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Exportion solution to " + name + "."); 143 bg.DoWork += (_, __) => selectedExporter.Export(Content, name); 144 bg.RunWorkerCompleted += (_, __) => MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this); 145 bg.RunWorkerAsync(); 146 } 147 } 119 148 } 120 149 … … 190 219 #endregion 191 220 } 221 222 public class Bla : NamedItemCollectionView<IResult> { 223 224 } 225 192 226 }
Note: See TracChangeset
for help on using the changeset viewer.