Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/12 09:11:17 (12 years ago)
Author:
gkronber
Message:

#1081 merged r7462:7609 from trunk into time series branch

Location:
branches/HeuristicLab.TimeSeries
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries

  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.QuadraticAssignment.Views

  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs

    r7268 r7615  
    2121
    2222using System;
    23 using System.Drawing;
    24 using System.IO;
    2523using System.Windows.Forms;
    26 using HeuristicLab.Common.Resources;
    27 using HeuristicLab.Core.Views;
    2824using HeuristicLab.MainForm;
    2925using HeuristicLab.MainForm.WindowsForms;
     26using HeuristicLab.Optimization.Views;
    3027
    3128namespace HeuristicLab.Problems.QuadraticAssignment.Views {
    3229  [View("Quadratic Assignment Problem View")]
    3330  [Content(typeof(QuadraticAssignmentProblem), IsDefaultView = true)]
    34   public sealed partial class QuadraticAssignmentProblemView : ParameterizedNamedItemView {
     31  public sealed partial class QuadraticAssignmentProblemView : HeuristicOptimizationProblemView {
    3532    public new QuadraticAssignmentProblem Content {
    3633      get { return (QuadraticAssignmentProblem)base.Content; }
     
    4037    public QuadraticAssignmentProblemView() {
    4138      InitializeComponent();
    42       importInstanceButton.Image = VSImageLibrary.Open;
    4339      Controls.Remove(parameterCollectionView);
    4440      parameterCollectionView.Dock = DockStyle.Fill;
     
    7470    protected override void OnContentChanged() {
    7571      base.OnContentChanged();
    76       instancesComboBox.Items.Clear();
    7772      if (Content != null) {
    78         foreach (string instance in Content.Instances) {
    79           instancesComboBox.Items.Add(instance);
    80         }
    8173        qapView.Distances = Content.Distances;
    8274        qapView.Weights = Content.Weights;
     
    9183    protected override void SetEnabledStateOfControls() {
    9284      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);
    14285    }
    14386  }
Note: See TracChangeset for help on using the changeset viewer.