Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9907 for trunk


Ignore:
Timestamp:
08/23/13 17:52:50 (11 years ago)
Author:
ascheibe
Message:

#1042

  • the size of the ProgressView is now adjusted if the Cancel button is not shown
  • replaced the progress bar of the start page with the ProgressView
Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.cs

    r9894 r9907  
    2525namespace HeuristicLab.MainForm.WindowsForms {
    2626  internal sealed partial class ProgressView : UserControl {
     27    private const int defaultControlHeight = 88;
     28    private const int collapsedControlHeight = 55;
     29
    2730    private readonly Control control;
    2831    public Control Control {
     
    8083        return;
    8184      }
     85      int height = Content.CanBeCanceled ? Height : collapsedControlHeight;
     86
    8287      Left = (Control.ClientRectangle.Width / 2) - (Width / 2);
    83       Top = (Control.ClientRectangle.Height / 2) - (Height / 2);
     88      Top = (Control.ClientRectangle.Height / 2) - (height / 2);
    8489      Anchor = AnchorStyles.None;
    8590
     
    127132      cancelButton.Visible = content != null && content.CanBeCanceled;
    128133      cancelButton.Enabled = content != null && content.CanBeCanceled;
     134
     135      if (content != null && content.CanBeCanceled) {
     136        Height = defaultControlHeight;
     137      } else if (content != null && !content.CanBeCanceled) {
     138        Height = collapsedControlHeight;
     139      }
    129140    }
    130141
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.designer.cs

    r9894 r9907  
    3535    /// </summary>
    3636    private void InitializeComponent() {
    37       this.components = new System.ComponentModel.Container();
    3837      this.progressBar = new System.Windows.Forms.ProgressBar();
    3938      this.statusLabel = new System.Windows.Forms.Label();
     
    4544      // progressBar
    4645      //
    47       this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    48                   | System.Windows.Forms.AnchorStyles.Right)));
     46      this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     47            | System.Windows.Forms.AnchorStyles.Right)));
    4948      this.progressBar.Location = new System.Drawing.Point(3, 3);
    5049      this.progressBar.Name = "progressBar";
     
    5554      // statusLabel
    5655      //
    57       this.statusLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    58                   | System.Windows.Forms.AnchorStyles.Right)));
     56      this.statusLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     57            | System.Windows.Forms.AnchorStyles.Right)));
    5958      this.statusLabel.Location = new System.Drawing.Point(3, 33);
    6059      this.statusLabel.Name = "statusLabel";
     
    7574      // panel
    7675      //
    77       this.panel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    78                   | System.Windows.Forms.AnchorStyles.Right)));
     76      this.panel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     77            | System.Windows.Forms.AnchorStyles.Left)
     78            | System.Windows.Forms.AnchorStyles.Right)));
    7979      this.panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    8080      this.panel.Controls.Add(this.progressBar);
     
    9494      this.panel.ResumeLayout(false);
    9595      this.ResumeLayout(false);
     96
    9697    }
    9798
  • trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.Designer.cs

    r9456 r9907  
    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  }
  • trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs

    r9456 r9907  
    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.