Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/12 14:21:02 (12 years ago)
Author:
sforsten
Message:

#1782:

  • removed loadButton
  • a new problem instance is loaded as soon as it is selected in the combobox
Location:
trunk/sources/HeuristicLab.Problems.Instances.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.Designer.cs

    r8031 r8196  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       this.loadButton = new System.Windows.Forms.Button();
    4948      this.instanceLabel = new System.Windows.Forms.Label();
    5049      this.instancesComboBox = new System.Windows.Forms.ComboBox();
    5150      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    52       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    5351      this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
    5452      this.SuspendLayout();
    55       //
    56       // loadButton
    57       //
    58       this.loadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    59       this.loadButton.Location = new System.Drawing.Point(667, -1);
    60       this.loadButton.Name = "loadButton";
    61       this.loadButton.Size = new System.Drawing.Size(24, 24);
    62       this.loadButton.TabIndex = 6;
    63       this.loadButton.Text = "Load";
    64       this.loadButton.UseVisualStyleBackColor = true;
    65       this.loadButton.Click += new System.EventHandler(this.loadButton_Click);
    6653      //
    6754      // instanceLabel
     
    7663      // instancesComboBox
    7764      //
    78       this.instancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     65      this.instancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    7966            | System.Windows.Forms.AnchorStyles.Right)));
    8067      this.instancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     
    8269      this.instancesComboBox.Location = new System.Drawing.Point(60, 1);
    8370      this.instancesComboBox.Name = "instancesComboBox";
    84       this.instancesComboBox.Size = new System.Drawing.Size(601, 21);
     71      this.instancesComboBox.Size = new System.Drawing.Size(632, 21);
    8572      this.instancesComboBox.TabIndex = 7;
    8673      this.instancesComboBox.DataSourceChanged += new System.EventHandler(this.instancesComboBox_DataSourceChanged);
    87       this.instancesComboBox.SelectedIndexChanged += new System.EventHandler(this.instancesComboBox_SelectedIndexChanged);
     74      this.instancesComboBox.SelectionChangeCommitted += new System.EventHandler(instancesComboBox_SelectionChangeCommitted);
    8875      //
    8976      // openFileDialog
     
    10289      this.Controls.Add(this.instanceLabel);
    10390      this.Controls.Add(this.instancesComboBox);
    104       this.Controls.Add(this.loadButton);
    10591      this.Name = "ProblemInstanceProviderViewGeneric";
    10692      this.Size = new System.Drawing.Size(694, 21);
     
    10995
    11096    }
    111 
    11297    #endregion
    11398
    11499    protected System.Windows.Forms.OpenFileDialog openFileDialog;
    115     protected System.Windows.Forms.ToolTip toolTip;
    116     protected System.Windows.Forms.Button loadButton;
    117100    protected System.Windows.Forms.Label instanceLabel;
    118101    protected System.Windows.Forms.ComboBox instancesComboBox;
  • trunk/sources/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.cs

    r8031 r8196  
    2424using System.Linq;
    2525using System.Windows.Forms;
    26 using HeuristicLab.Common.Resources;
    2726using HeuristicLab.MainForm;
    2827using HeuristicLab.MainForm.WindowsForms;
     
    5150    public ProblemInstanceProviderViewGeneric() {
    5251      InitializeComponent();
    53       loadButton.Text = String.Empty;
    54       loadButton.Image = VSImageLibrary.RefreshDocument;
    55       toolTip.SetToolTip(loadButton, "Load the selected problem.");
    5652    }
    5753
     
    7369        instanceLabel.Show();
    7470        instancesComboBox.Show();
    75         loadButton.Show();
    7671      } else {
    7772        instanceLabel.Hide();
    7873        instancesComboBox.Hide();
    79         loadButton.Hide();
    8074      }
    8175    }
     
    8478      base.SetEnabledStateOfControls();
    8579      instancesComboBox.Enabled = !ReadOnly && !Locked && Content != null && GenericConsumer != null;
    86       loadButton.Enabled = !ReadOnly && !Locked && Content != null && GenericConsumer != null && instancesComboBox.SelectedIndex >= 0;
    87     }
    88 
    89     protected virtual void loadButton_Click(object sender, EventArgs e) {
    90       var descriptor = (IDataDescriptor)instancesComboBox.SelectedItem;
    91       T instance = Content.LoadData(descriptor);
    92       try {
    93         GenericConsumer.Load(instance);
    94       }
    95       catch (Exception ex) {
    96         MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", descriptor.Name, Environment.NewLine + ex.Message), "Cannot load instance");
    97       }
    9880    }
    9981
     
    10486    }
    10587
    106     private void instancesComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
    107       SetEnabledStateOfControls();
     88    private void instancesComboBox_SelectionChangeCommitted(object sender, System.EventArgs e) {
     89      if (instancesComboBox.SelectedIndex >= 0) {
     90        var descriptor = (IDataDescriptor)instancesComboBox.SelectedItem;
     91        T instance = Content.LoadData(descriptor);
     92        try {
     93          GenericConsumer.Load(instance);
     94        }
     95        catch (Exception ex) {
     96          MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", descriptor.Name, Environment.NewLine + ex.Message), "Cannot load instance");
     97        }
     98      }
    10899    }
    109100  }
Note: See TracChangeset for help on using the changeset viewer.