Changeset 7615 for branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs
- Timestamp:
- 03/15/12 09:11:17 (13 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.QuadraticAssignment.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views merged: 7558
- Property svn:mergeinfo changed
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs
r7268 r7615 21 21 22 22 using System; 23 using System.Drawing;24 using System.IO;25 23 using System.Windows.Forms; 26 using HeuristicLab.Common.Resources;27 using HeuristicLab.Core.Views;28 24 using HeuristicLab.MainForm; 29 25 using HeuristicLab.MainForm.WindowsForms; 26 using HeuristicLab.Optimization.Views; 30 27 31 28 namespace HeuristicLab.Problems.QuadraticAssignment.Views { 32 29 [View("Quadratic Assignment Problem View")] 33 30 [Content(typeof(QuadraticAssignmentProblem), IsDefaultView = true)] 34 public sealed partial class QuadraticAssignmentProblemView : ParameterizedNamedItemView {31 public sealed partial class QuadraticAssignmentProblemView : HeuristicOptimizationProblemView { 35 32 public new QuadraticAssignmentProblem Content { 36 33 get { return (QuadraticAssignmentProblem)base.Content; } … … 40 37 public QuadraticAssignmentProblemView() { 41 38 InitializeComponent(); 42 importInstanceButton.Image = VSImageLibrary.Open;43 39 Controls.Remove(parameterCollectionView); 44 40 parameterCollectionView.Dock = DockStyle.Fill; … … 74 70 protected override void OnContentChanged() { 75 71 base.OnContentChanged(); 76 instancesComboBox.Items.Clear();77 72 if (Content != null) { 78 foreach (string instance in Content.Instances) {79 instancesComboBox.Items.Add(instance);80 }81 73 qapView.Distances = Content.Distances; 82 74 qapView.Weights = Content.Weights; … … 91 83 protected override void SetEnabledStateOfControls() { 92 84 base.SetEnabledStateOfControls(); 93 instancesComboBox.Enabled = !ReadOnly && !Locked && Content != null;94 loadInstanceButton.Enabled = !ReadOnly && !Locked && Content != null && instancesComboBox.SelectedItem != null;95 importInstanceButton.Enabled = !ReadOnly && !Locked && Content != null;96 }97 98 private void instancesComboBox_SelectedValueChanged(object sender, System.EventArgs e) {99 loadInstanceButton.Enabled = instancesComboBox.SelectedItem != null;100 }101 102 private void loadInstanceButton_Click(object sender, System.EventArgs e) {103 string instance = instancesComboBox.SelectedItem as string;104 try {105 Content.LoadInstanceFromEmbeddedResource(instance);106 } catch (Exception ex) {107 PluginInfrastructure.ErrorHandling.ShowErrorDialog(ex);108 }109 }110 111 private void importInstanceButton_Click(object sender, System.EventArgs e) {112 if (openFileDialog.ShowDialog() == DialogResult.OK) {113 try {114 string datFile = openFileDialog.FileName;115 string directory = Path.GetDirectoryName(datFile);116 string solFile = Path.Combine(directory, Path.GetFileNameWithoutExtension(datFile) + ".sln");117 if (File.Exists(solFile)) {118 Content.LoadInstanceFromFile(datFile, solFile);119 } else {120 Content.LoadInstanceFromFile(datFile);121 }122 } catch (Exception ex) {123 PluginInfrastructure.ErrorHandling.ShowErrorDialog(ex);124 }125 }126 }127 128 private void QAPLIBInstancesLabel_Click(object sender, System.EventArgs e) {129 System.Diagnostics.Process.Start("http://www.seas.upenn.edu/qaplib/");130 }131 132 private void QAPLIBInstancesLabel_MouseEnter(object sender, EventArgs e) {133 Cursor = Cursors.Hand;134 QAPLIBInstancesLabel.ForeColor = Color.Red;135 toolTip.SetToolTip(QAPLIBInstancesLabel, "Browse to http://www.seas.upenn.edu/qaplib/");136 }137 138 private void QAPLIBInstancesLabel_MouseLeave(object sender, EventArgs e) {139 Cursor = Cursors.Default;140 QAPLIBInstancesLabel.ForeColor = Color.Blue;141 toolTip.SetToolTip(QAPLIBInstancesLabel, String.Empty);142 85 } 143 86 }
Note: See TracChangeset
for help on using the changeset viewer.