Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/03/13 15:55:36 (11 years ago)
Author:
ascheibe
Message:

#1042 merged r9849, r9851, r9865, r9867, r9868, r9893, r9894, r9895, r9896, r9900, r9901, r9905, r9907 into stable branch

Location:
stable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Optimizer/3.3/FileManager.cs

    r9456 r9933  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.Linq;
     24using System.IO;
    2525using System.Windows.Forms;
    2626using HeuristicLab.Common;
     
    9898          SaveAs(view);
    9999        else {
    100           ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).SetAppStartingCursor();
    101           SetEnabledStateOfContentViews(content, false);
     100          MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor();
     101          SetSaveOperationProgressInContentViews(content, true);
    102102          ContentManager.SaveAsync(content, content.Filename, true, SavingCompleted);
    103103        }
     
    123123
    124124        if (saveFileDialog.ShowDialog() == DialogResult.OK) {
    125           ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).SetAppStartingCursor();
    126           SetEnabledStateOfContentViews(content, false);
     125          MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor();
     126          SetSaveOperationProgressInContentViews(content, true, saveFileDialog.FileName);
    127127          if (saveFileDialog.FilterIndex == 1) {
    128128            ContentManager.SaveAsync(content, saveFileDialog.FileName, false, SavingCompleted);
     
    135135    private static void SavingCompleted(IStorableContent content, Exception error) {
    136136      try {
    137         SetEnabledStateOfContentViews(content, true);
    138137        if (error != null) throw error;
    139138        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().UpdateTitle();
     
    143142      }
    144143      finally {
    145         ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).ResetAppStartingCursor();
     144        SetSaveOperationProgressInContentViews(content, false);
     145        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().ResetAppStartingCursor();
    146146      }
    147147    }
    148148
    149     private static void SetEnabledStateOfContentViews(IStorableContent content, bool enabled) {
     149    private static void SetSaveOperationProgressInContentViews(IStorableContent content, bool showProgress, string fileName = null) {
    150150      HeuristicLab.MainForm.WindowsForms.MainForm mainForm = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>();
    151151      #region Mono Compatibility
    152152      // removed the InvokeRequired check because of Mono
    153153      mainForm.Invoke((Action)delegate {
    154         var views = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v.Content == content).ToList();
    155         views.ForEach(v => v.Enabled = enabled);
     154        if (showProgress) {
     155          mainForm.AddOperationProgressToContent(content, string.Format("Saving to file \"{0}\"...", Path.GetFileName(fileName ?? content.Filename)));
     156        } else
     157          mainForm.RemoveOperationProgressFromContent(content);
    156158      });
    157159      #endregion
  • stable/HeuristicLab.Optimizer/3.3/StartPage.Designer.cs

    r9456 r9933  
    5050      this.titleLabel = new System.Windows.Forms.Label();
    5151      this.samplesGroupBox = new System.Windows.Forms.GroupBox();
    52       this.loadingPanel = new System.Windows.Forms.Panel();
    53       this.loadingProgressBar = new System.Windows.Forms.ProgressBar();
    54       this.loadingLabel = new System.Windows.Forms.Label();
    5552      this.samplesListView = new System.Windows.Forms.ListView();
    56       this.nameColumnHeader = new System.Windows.Forms.ColumnHeader();
    57       this.descriptionColumnHeader = new System.Windows.Forms.ColumnHeader();
     53      this.nameColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
     54      this.descriptionColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
    5855      this.imageList = new System.Windows.Forms.ImageList(this.components);
    5956      this.splitContainer = new System.Windows.Forms.SplitContainer();
    6057      this.samplesGroupBox.SuspendLayout();
    61       this.loadingPanel.SuspendLayout();
     58      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    6259      this.splitContainer.Panel1.SuspendLayout();
    6360      this.splitContainer.Panel2.SuspendLayout();
     
    8077      // firstStepsRichTextBox
    8178      //
    82       this.firstStepsRichTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    83                   | System.Windows.Forms.AnchorStyles.Left)
    84                   | System.Windows.Forms.AnchorStyles.Right)));
     79      this.firstStepsRichTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     80            | System.Windows.Forms.AnchorStyles.Left)
     81            | System.Windows.Forms.AnchorStyles.Right)));
    8582      this.firstStepsRichTextBox.BackColor = System.Drawing.SystemColors.Control;
    8683      this.firstStepsRichTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
     
    9693      // titleLabel
    9794      //
    98       this.titleLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    99                   | System.Windows.Forms.AnchorStyles.Right)));
     95      this.titleLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     96            | System.Windows.Forms.AnchorStyles.Right)));
    10097      this.titleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    10198      this.titleLabel.Location = new System.Drawing.Point(-1, 0);
     
    108105      // samplesGroupBox
    109106      //
    110       this.samplesGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    111                   | System.Windows.Forms.AnchorStyles.Left)
    112                   | System.Windows.Forms.AnchorStyles.Right)));
    113       this.samplesGroupBox.Controls.Add(this.loadingPanel);
     107      this.samplesGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     108            | System.Windows.Forms.AnchorStyles.Left)
     109            | System.Windows.Forms.AnchorStyles.Right)));
    114110      this.samplesGroupBox.Controls.Add(this.samplesListView);
    115111      this.samplesGroupBox.Location = new System.Drawing.Point(0, 3);
     
    119115      this.samplesGroupBox.TabStop = false;
    120116      this.samplesGroupBox.Text = "Samples";
    121       //
    122       // loadingPanel
    123       //
    124       this.loadingPanel.Anchor = System.Windows.Forms.AnchorStyles.None;
    125       this.loadingPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    126       this.loadingPanel.Controls.Add(this.loadingProgressBar);
    127       this.loadingPanel.Controls.Add(this.loadingLabel);
    128       this.loadingPanel.Enabled = false;
    129       this.loadingPanel.Location = new System.Drawing.Point(189, 89);
    130       this.loadingPanel.Name = "loadingPanel";
    131       this.loadingPanel.Size = new System.Drawing.Size(350, 62);
    132       this.loadingPanel.TabIndex = 1;
    133       //
    134       // loadingProgressBar
    135       //
    136       this.loadingProgressBar.Anchor = System.Windows.Forms.AnchorStyles.None;
    137       this.loadingProgressBar.Location = new System.Drawing.Point(101, 19);
    138       this.loadingProgressBar.Name = "loadingProgressBar";
    139       this.loadingProgressBar.Size = new System.Drawing.Size(229, 23);
    140       this.loadingProgressBar.Step = 1;
    141       this.loadingProgressBar.TabIndex = 1;
    142       //
    143       // loadingLabel
    144       //
    145       this.loadingLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
    146       this.loadingLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    147       this.loadingLabel.Location = new System.Drawing.Point(12, 19);
    148       this.loadingLabel.Name = "loadingLabel";
    149       this.loadingLabel.Size = new System.Drawing.Size(83, 23);
    150       this.loadingLabel.TabIndex = 0;
    151       this.loadingLabel.Text = "Loading ...";
    152117      //
    153118      // samplesListView
     
    168133      this.samplesListView.UseCompatibleStateImageBehavior = false;
    169134      this.samplesListView.View = System.Windows.Forms.View.Details;
     135      this.samplesListView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.samplesListView_ItemDrag);
    170136      this.samplesListView.DoubleClick += new System.EventHandler(this.samplesListView_DoubleClick);
    171       this.samplesListView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.samplesListView_ItemDrag);
    172137      //
    173138      // nameColumnHeader
     
    189154      // splitContainer
    190155      //
    191       this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    192                   | System.Windows.Forms.AnchorStyles.Left)
    193                   | System.Windows.Forms.AnchorStyles.Right)));
     156      this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     157            | System.Windows.Forms.AnchorStyles.Left)
     158            | System.Windows.Forms.AnchorStyles.Right)));
    194159      this.splitContainer.Location = new System.Drawing.Point(0, 0);
    195160      this.splitContainer.Name = "splitContainer";
     
    210175      // StartPage
    211176      //
    212       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    213177      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    214178      this.Controls.Add(this.splitContainer);
     
    217181      this.Size = new System.Drawing.Size(728, 640);
    218182      this.samplesGroupBox.ResumeLayout(false);
    219       this.loadingPanel.ResumeLayout(false);
    220183      this.splitContainer.Panel1.ResumeLayout(false);
    221184      this.splitContainer.Panel2.ResumeLayout(false);
     185      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
    222186      this.splitContainer.ResumeLayout(false);
    223187      this.ResumeLayout(false);
     
    236200    private System.Windows.Forms.ImageList imageList;
    237201    private System.Windows.Forms.ColumnHeader descriptionColumnHeader;
    238     private System.Windows.Forms.Panel loadingPanel;
    239     private System.Windows.Forms.ProgressBar loadingProgressBar;
    240     private System.Windows.Forms.Label loadingLabel;
    241202    private System.Windows.Forms.SplitContainer splitContainer;
    242203  }
  • stable/HeuristicLab.Optimizer/3.3/StartPage.cs

    r9456 r9933  
    3434  [View("Start Page")]
    3535  public partial class StartPage : HeuristicLab.MainForm.WindowsForms.View {
     36    private IProgress progress;
     37
    3638    public StartPage() {
    3739      InitializeComponent();
     
    6769
    6870    private void LoadSamples(object state) {
     71      progress = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(samplesListView, "Loading...");
    6972      Assembly assembly = Assembly.GetExecutingAssembly();
    7073      var samples = assembly.GetManifestResourceNames().Where(x => x.EndsWith(".hl"));
     
    7780            WriteStreamToTempFile(stream, path);
    7881            INamedItem item = XmlParser.Deserialize<INamedItem>(path);
    79             OnSampleLoaded(item, loadingProgressBar.Maximum / count);
     82            OnSampleLoaded(item, 1.0 / count);
    8083          }
    8184        }
    82         catch (Exception) { }
     85        catch (Exception) {
     86          MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(samplesListView);
     87        }
    8388      }
    8489      OnAllSamplesLoaded();
    8590    }
    86     private void OnSampleLoaded(INamedItem sample, int progress) {
     91    private void OnSampleLoaded(INamedItem sample, double progress) {
    8792      if (InvokeRequired)
    88         Invoke(new Action<INamedItem, int>(OnSampleLoaded), sample, progress);
     93        Invoke(new Action<INamedItem, double>(OnSampleLoaded), sample, progress);
    8994      else {
    9095        ListViewItem item = new ListViewItem(new string[] { sample.Name, sample.Description });
     
    9499        item.Tag = sample;
    95100        samplesListView.Items.Add(item);
    96         loadingProgressBar.Value += progress;
     101        this.progress.ProgressValue += progress;
    97102      }
    98103    }
     
    106111            samplesListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    107112        }
    108         loadingPanel.Visible = false;
     113        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(samplesListView);
    109114      }
    110115    }
Note: See TracChangeset for help on using the changeset viewer.