Changeset 7615 for branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.cs
- Timestamp:
- 03/15/12 09:11:17 (13 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.TravelingSalesman.Views/3.3/TravelingSalesmanProblemView.cs
r7268 r7615 22 22 using System; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Core;25 using HeuristicLab.Core.Views;26 24 using HeuristicLab.MainForm; 27 using HeuristicLab. PluginInfrastructure;25 using HeuristicLab.Optimization.Views; 28 26 29 27 namespace HeuristicLab.Problems.TravelingSalesman.Views { … … 33 31 [View("Traveling Salesman Problem View")] 34 32 [Content(typeof(TravelingSalesmanProblem), true)] 35 public sealed partial class TravelingSalesmanProblemView : NamedItemView { 36 private TSPLIBImportDialog tsplibImportDialog; 37 33 public sealed partial class TravelingSalesmanProblemView : HeuristicOptimizationProblemView { 38 34 public new TravelingSalesmanProblem Content { 39 35 get { return (TravelingSalesmanProblem)base.Content; } … … 46 42 public TravelingSalesmanProblemView() { 47 43 InitializeComponent(); 48 }49 50 protected override void Dispose(bool disposing) {51 if (disposing) {52 if (tsplibImportDialog != null) tsplibImportDialog.Dispose();53 if (components != null) components.Dispose();54 }55 base.Dispose(disposing);56 44 } 57 45 … … 72 60 base.OnContentChanged(); 73 61 if (Content == null) { 74 parameterCollectionView.Content = null;75 62 pathTSPTourView.Content = null; 76 63 } else { 77 parameterCollectionView.Content = ((IParameterizedNamedItem)Content).Parameters;78 64 pathTSPTourView.Content = new PathTSPTour(Content.Coordinates, Content.BestKnownSolution, Content.BestKnownQuality); 79 65 } … … 82 68 protected override void SetEnabledStateOfControls() { 83 69 base.SetEnabledStateOfControls(); 84 parameterCollectionView.Enabled = Content != null;85 70 pathTSPTourView.Enabled = Content != null; 86 importButton.Enabled = Content != null && !ReadOnly;87 }88 89 private void importButton_Click(object sender, System.EventArgs e) {90 if (tsplibImportDialog == null) tsplibImportDialog = new TSPLIBImportDialog();91 92 if (tsplibImportDialog.ShowDialog(this) == DialogResult.OK) {93 try {94 if (tsplibImportDialog.Quality == null)95 Content.ImportFromTSPLIB(tsplibImportDialog.TSPFileName, tsplibImportDialog.TourFileName);96 else97 Content.ImportFromTSPLIB(tsplibImportDialog.TSPFileName, tsplibImportDialog.TourFileName, (double)tsplibImportDialog.Quality);98 }99 catch (Exception ex) {100 ErrorHandling.ShowErrorDialog(this, ex);101 }102 }103 71 } 104 72
Note: See TracChangeset
for help on using the changeset viewer.