Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/19/10 19:43:05 (14 years ago)
Author:
mkommend
Message:

Adjusted the SetEnabledStateOfControls method in all views, added the Enabled property into the IView interface and adapted the ViewHost, View and ContentView class (ticket #1155).

Location:
trunk/sources/HeuristicLab.Core.Views/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/Clipboard.cs

    r3904 r4435  
    182182        try {
    183183          i++;
     184          SetEnabledStateOfContentViews(item, false);
    184185          XmlGenerator.Serialize(item, ItemsPath + Path.DirectorySeparatorChar + i.ToString("00000000") + ".hl", 9);
    185186          OnItemSaved(item, progressBar.Maximum / listView.Items.Count);
     
    192193      if (item != null) {
    193194        if (InvokeRequired)
    194           Invoke(new Action<T, int>(OnItemLoaded), item, progress);
    195         else
     195          Invoke(new Action<T, int>(OnItemSaved), item, progress);
     196        else {
    196197          progressBar.Value += progress;
     198          SetEnabledStateOfContentViews(item, true);
     199        }
    197200      }
    198201    }
     
    203206        Enabled = true;
    204207        infoPanel.Visible = false;
     208      }
     209    }
     210
     211    private void SetEnabledStateOfContentViews(IItem item, bool enabled) {
     212      if (InvokeRequired)
     213        Invoke((Action<IItem, bool>)SetEnabledStateOfContentViews, item, enabled);
     214      else {
     215        var views = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v.Content == item).ToList();
     216        views.ForEach(v => v.Enabled = enabled);
    205217      }
    206218    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/VariableValueView.Designer.cs

    r3281 r4435  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.valuePanel = new System.Windows.Forms.Panel();
    4847      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    49       this.valuePanel.SuspendLayout();
    5048      this.SuspendLayout();
    51       //
    52       // valuePanel
    53       //
    54       this.valuePanel.AllowDrop = true;
    55       this.valuePanel.Controls.Add(this.viewHost);
    56       this.valuePanel.Dock = System.Windows.Forms.DockStyle.Fill;
    57       this.valuePanel.Location = new System.Drawing.Point(0, 0);
    58       this.valuePanel.Name = "valuePanel";
    59       this.valuePanel.Size = new System.Drawing.Size(359, 274);
    60       this.valuePanel.TabIndex = 0;
    61       this.valuePanel.DragOver += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragEnterOver);
    62       this.valuePanel.DragDrop += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragDrop);
    63       this.valuePanel.DragEnter += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragEnterOver);
    6449      //
    6550      // viewHost
    6651      //
     52      this.viewHost.Caption = "View";
    6753      this.viewHost.Content = null;
    6854      this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    6955      this.viewHost.Location = new System.Drawing.Point(0, 0);
    7056      this.viewHost.Name = "viewHost";
     57      this.viewHost.ReadOnly = false;
    7158      this.viewHost.Size = new System.Drawing.Size(359, 274);
    7259      this.viewHost.TabIndex = 0;
     
    7764      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    7865      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    79       this.Controls.Add(this.valuePanel);
     66      this.Controls.Add(this.viewHost);
    8067      this.Name = "VariableValueView";
    8168      this.Size = new System.Drawing.Size(359, 274);
    82       this.valuePanel.ResumeLayout(false);
    8369      this.ResumeLayout(false);
    8470
     
    8773    #endregion
    8874
    89     protected HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
    90     protected System.Windows.Forms.Panel valuePanel;
     75    protected MainForm.WindowsForms.ViewHost viewHost;
     76
    9177  }
    9278}
  • trunk/sources/HeuristicLab.Core.Views/3.3/VariableValueView.cs

    r4068 r4435  
    7777    }
    7878
    79     protected override void SetEnabledStateOfControls() {
    80       base.SetEnabledStateOfControls();
    81       valuePanel.Enabled = Content != null;
    82     }
    83 
    8479    protected virtual void Content_ValueChanged(object sender, EventArgs e) {
    8580      if (InvokeRequired)
Note: See TracChangeset for help on using the changeset viewer.