Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/07/16 15:26:47 (9 years ago)
Author:
abeham
Message:

#2457: Added toolbar, fixed some bugs

Location:
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3
Files:
2 added
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/HeuristicLab.OptimizationExpertSystem-3.3.csproj

    r13743 r13748  
    191191      <DependentUpon>AlgorithmControlForm.cs</DependentUpon>
    192192    </Compile>
     193    <Compile Include="Toolbar\DownloadFromOKBToolbarItem.cs" />
     194    <Compile Include="Toolbar\ToolbarItemBase.cs" />
    193195    <Compile Include="Views\KnowledgeCenterAllinOneView.cs">
    194196      <SubType>UserControl</SubType>
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Menu/0_Config/30_DownloadFromOkbMenuItem.cs

    r13720 r13748  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Common.Resources;
     24using HeuristicLab.MainForm;
    2325using System;
    2426using System.Collections.Generic;
     
    4143    }
    4244
    43     public override string ToolTipText { get { return "Download relevant runs from the knowledge base."; } }
     45    public override string ToolTipText {
     46      get {
     47        return @"Download relevant runs, including algorithm instances
     48and problem instances from the OKB server.";
     49      }
     50    }
    4451
    4552    public override void Execute() {
     
    5158      ToolStripItem.Enabled = MainForm.ExpertSystem.Problem.ProblemId != -1;
    5259      MainForm.ExpertSystem.Problem.ProblemChanged += OnProblemChanged;
     60      MainForm.ExpertSystem.DownloadStarted += OnDownloadStarted;
    5361    }
    5462
     
    5664      ToolStripItem.Enabled = MainForm.ExpertSystem.Problem.ProblemId != -1;
    5765    }
     66
     67    private void OnDownloadStarted(object sender, EventArgs<IProgress> e) {
     68      ToolStripItem.Enabled = false;
     69      e.Value.ProgressStateChanged += DownloadProgressOnStateChanged;
     70    }
     71
     72    private void DownloadProgressOnStateChanged(object sender, EventArgs eventArgs) {
     73      var progress = (IProgress)sender;
     74      if (progress.ProgressState == ProgressState.Finished || progress.ProgressState == ProgressState.Canceled) {
     75        ToolStripItem.Enabled = true;
     76        progress.ProgressStateChanged -= DownloadProgressOnStateChanged;
     77      }
     78    }
    5879  }
    5980}
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/OptimizationKnowledgeCenter.cs

    r13722 r13748  
    4242
    4343    private void ExpertSystemOnDownloadStarted(object sender, EventArgs<IProgress> e) {
     44      if (InvokeRequired) { Invoke((Action<object, EventArgs<IProgress>>)ExpertSystemOnDownloadStarted, sender, e); return; }
    4445      e.Value.ProgressStateChanged += OnProgressStateChanged;
    4546      e.Value.ProgressValueChanged += OnProgressValueChanged;
     
    5253
    5354    private void OnProgressStateChanged(object sender, EventArgs e) {
     55      if (InvokeRequired) { Invoke((Action<object, EventArgs>)OnProgressStateChanged, sender, e); return; }
    5456      var progress = (IProgress)sender;
    5557      if (progress.ProgressState == ProgressState.Canceled
     
    6466
    6567    private void OnProgressValueChanged(object sender, EventArgs e) {
     68      if (InvokeRequired) { Invoke((Action<object, EventArgs>)OnProgressValueChanged, sender, e); return; }
    6669      var progress = (IProgress)sender;
    6770      progressBar.Value = Math.Max(progressBar.Minimum, Math.Min(progressBar.Maximum, (int)(progress.ProgressValue * 100)));
     
    6972
    7073    private void OnProgressStatusChanged(object sender, EventArgs e) {
     74      if (InvokeRequired) { Invoke((Action<object, EventArgs>)OnProgressStatusChanged, sender, e); return; }
    7175      var progress = (IProgress)sender;
    7276      progressLabel.Text = progress.Status.Replace(Environment.NewLine, "   ");
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Toolbar/ToolbarItemBase.cs

    r13739 r13748  
    2222using HeuristicLab.MainForm.WindowsForms;
    2323
    24 namespace HeuristicLab.OptimizationExpertSystem.Menu {
    25   internal abstract class MenuItemBase : MenuItem, IOptimizationKnowledgeCenterUi {
     24namespace HeuristicLab.OptimizationExpertSystem.Toolbar {
     25  internal abstract class ToolbarItemBase : ToolBarItem, IOptimizationKnowledgeCenterUi {
    2626    public OptimizationKnowledgeCenter MainForm {
    2727      get { return (OptimizationKnowledgeCenter)HeuristicLab.MainForm.MainFormManager.MainForm; }
Note: See TracChangeset for help on using the changeset viewer.