Changeset 3277


Ignore:
Timestamp:
04/06/10 04:50:13 (11 years ago)
Author:
swagner
Message:

Continued work on algorithm batch processing (#947).

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.Designer.cs

    r3260 r3277  
    2020#endregion
    2121
     22using System;
     23using System.Windows.Forms;
     24using System.ComponentModel;
     25
    2226namespace HeuristicLab.Optimization.Views {
    2327  partial class RunCollectionView {
    24     /// <summary> 
     28    /// <summary>
    2529    /// Required designer variable.
    2630    /// </summary>
    2731    private System.ComponentModel.IContainer components = null;
    2832
    29     /// <summary> 
     33    /// <summary>
    3034    /// Clean up any resources being used.
    3135    /// </summary>
     
    3337    protected override void Dispose(bool disposing) {
    3438      if (disposing) {
     39        foreach (ListViewItem item in itemsListView.Items)
     40          ((Run)item.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged);
    3541        if (components != null) components.Dispose();
    3642      }
     
    3844    }
    3945
    40     #region Component Designer generated code
     46    #region Windows Form Designer generated code
    4147
    42     /// <summary> 
    43     /// Required method for Designer support - do not modify 
     48    /// <summary>
     49    /// Required method for Designer support - do not modify
    4450    /// the contents of this method with the code editor.
    4551    /// </summary>
    4652    private void InitializeComponent() {
    47       components = new System.ComponentModel.Container();
    48       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     53      this.components = new System.ComponentModel.Container();
     54      this.splitContainer = new System.Windows.Forms.SplitContainer();
     55      this.itemsListView = new System.Windows.Forms.ListView();
     56      this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
     57      this.imageList = new System.Windows.Forms.ImageList(this.components);
     58      this.removeButton = new System.Windows.Forms.Button();
     59      this.detailsGroupBox = new System.Windows.Forms.GroupBox();
     60      this.viewHost = new HeuristicLab.Core.Views.ViewHost();
     61      this.itemsGroupBox = new System.Windows.Forms.GroupBox();
     62      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     63      this.splitContainer.Panel1.SuspendLayout();
     64      this.splitContainer.Panel2.SuspendLayout();
     65      this.splitContainer.SuspendLayout();
     66      this.detailsGroupBox.SuspendLayout();
     67      this.itemsGroupBox.SuspendLayout();
     68      this.SuspendLayout();
     69      //
     70      // splitContainer
     71      //
     72      this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
     73      this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
     74      this.splitContainer.Location = new System.Drawing.Point(3, 16);
     75      this.splitContainer.Name = "splitContainer";
     76      //
     77      // splitContainer.Panel1
     78      //
     79      this.splitContainer.Panel1.Controls.Add(this.itemsListView);
     80      this.splitContainer.Panel1.Controls.Add(this.removeButton);
     81      this.splitContainer.Panel1MinSize = 100;
     82      //
     83      // splitContainer.Panel2
     84      //
     85      this.splitContainer.Panel2.Controls.Add(this.detailsGroupBox);
     86      this.splitContainer.Size = new System.Drawing.Size(526, 364);
     87      this.splitContainer.SplitterDistance = 250;
     88      this.splitContainer.TabIndex = 0;
     89      //
     90      // itemsListView
     91      //
     92      this.itemsListView.AllowDrop = true;
     93      this.itemsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     94                  | System.Windows.Forms.AnchorStyles.Left)
     95                  | System.Windows.Forms.AnchorStyles.Right)));
     96      this.itemsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     97            this.columnHeader1});
     98      this.itemsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
     99      this.itemsListView.HideSelection = false;
     100      this.itemsListView.Location = new System.Drawing.Point(3, 33);
     101      this.itemsListView.Name = "itemsListView";
     102      this.itemsListView.ShowItemToolTips = true;
     103      this.itemsListView.Size = new System.Drawing.Size(244, 327);
     104      this.itemsListView.SmallImageList = this.imageList;
     105      this.itemsListView.TabIndex = 1;
     106      this.itemsListView.UseCompatibleStateImageBehavior = false;
     107      this.itemsListView.View = System.Windows.Forms.View.Details;
     108      this.itemsListView.SelectedIndexChanged += new System.EventHandler(this.itemsListView_SelectedIndexChanged);
     109      this.itemsListView.SizeChanged += new System.EventHandler(this.itemsListView_SizeChanged);
     110      this.itemsListView.DoubleClick += new System.EventHandler(this.itemsListView_DoubleClick);
     111      this.itemsListView.DragDrop += new System.Windows.Forms.DragEventHandler(this.itemsListView_DragDrop);
     112      this.itemsListView.DragEnter += new System.Windows.Forms.DragEventHandler(this.itemsListView_DragEnterOver);
     113      this.itemsListView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.itemsListView_KeyDown);
     114      this.itemsListView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.itemsListView_ItemDrag);
     115      this.itemsListView.DragOver += new System.Windows.Forms.DragEventHandler(this.itemsListView_DragEnterOver);
     116      //
     117      // imageList
     118      //
     119      this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     120      this.imageList.ImageSize = new System.Drawing.Size(16, 16);
     121      this.imageList.TransparentColor = System.Drawing.Color.Transparent;
     122      //
     123      // removeButton
     124      //
     125      this.removeButton.Enabled = false;
     126      this.removeButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Remove;
     127      this.removeButton.Location = new System.Drawing.Point(3, 3);
     128      this.removeButton.Name = "removeButton";
     129      this.removeButton.Size = new System.Drawing.Size(24, 24);
     130      this.removeButton.TabIndex = 0;
     131      this.toolTip.SetToolTip(this.removeButton, "Remove");
     132      this.removeButton.UseVisualStyleBackColor = true;
     133      this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
     134      //
     135      // detailsGroupBox
     136      //
     137      this.detailsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     138                  | System.Windows.Forms.AnchorStyles.Left)
     139                  | System.Windows.Forms.AnchorStyles.Right)));
     140      this.detailsGroupBox.Controls.Add(this.viewHost);
     141      this.detailsGroupBox.Location = new System.Drawing.Point(3, 27);
     142      this.detailsGroupBox.Name = "detailsGroupBox";
     143      this.detailsGroupBox.Size = new System.Drawing.Size(266, 335);
     144      this.detailsGroupBox.TabIndex = 0;
     145      this.detailsGroupBox.TabStop = false;
     146      this.detailsGroupBox.Text = "Details";
     147      //
     148      // viewHost
     149      //
     150      this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     151                  | System.Windows.Forms.AnchorStyles.Left)
     152                  | System.Windows.Forms.AnchorStyles.Right)));
     153      this.viewHost.Content = null;
     154      this.viewHost.Location = new System.Drawing.Point(6, 19);
     155      this.viewHost.Name = "viewHost";
     156      this.viewHost.Size = new System.Drawing.Size(254, 310);
     157      this.viewHost.TabIndex = 0;
     158      this.viewHost.ViewType = null;
     159      //
     160      // itemsGroupBox
     161      //
     162      this.itemsGroupBox.Controls.Add(this.splitContainer);
     163      this.itemsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
     164      this.itemsGroupBox.Location = new System.Drawing.Point(0, 0);
     165      this.itemsGroupBox.Name = "itemsGroupBox";
     166      this.itemsGroupBox.Size = new System.Drawing.Size(532, 383);
     167      this.itemsGroupBox.TabIndex = 0;
     168      this.itemsGroupBox.TabStop = false;
     169      this.itemsGroupBox.Text = "Items";
     170      //
     171      // RunCollectionView
     172      //
     173      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     174      this.Controls.Add(this.itemsGroupBox);
     175      this.Name = "RunCollectionView";
     176      this.Size = new System.Drawing.Size(532, 383);
     177      this.splitContainer.Panel1.ResumeLayout(false);
     178      this.splitContainer.Panel2.ResumeLayout(false);
     179      this.splitContainer.ResumeLayout(false);
     180      this.detailsGroupBox.ResumeLayout(false);
     181      this.itemsGroupBox.ResumeLayout(false);
     182      this.ResumeLayout(false);
     183
    49184    }
    50185
    51186    #endregion
     187
     188    protected System.Windows.Forms.SplitContainer splitContainer;
     189    protected System.Windows.Forms.ColumnHeader columnHeader1;
     190    protected GroupBox itemsGroupBox;
     191    protected ListView itemsListView;
     192    protected GroupBox detailsGroupBox;
     193    protected Button removeButton;
     194    protected ToolTip toolTip;
     195    protected ImageList imageList;
     196    protected HeuristicLab.Core.Views.ViewHost viewHost;
    52197  }
    53198}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r3274 r3277  
    2323using HeuristicLab.Core.Views;
    2424using HeuristicLab.MainForm;
     25using HeuristicLab.MainForm.WindowsForms;
     26using System.Windows.Forms;
     27using System;
     28using System.Collections.Generic;
    2529
    2630namespace HeuristicLab.Optimization.Views {
     
    2832  [Content(typeof(RunCollection), true)]
    2933  [Content(typeof(IObservableCollection<Run>), false)]
    30   public partial class RunCollectionView : ItemCollectionView<Run> {
    31     /// <summary>
    32     /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
    33     /// </summary>
     34  public partial class RunCollectionView : AsynchronousContentView {
     35    public new IObservableCollection<Run> Content {
     36      get { return (IObservableCollection<Run>)base.Content; }
     37      set { base.Content = value; }
     38    }
     39
     40    public ListView ItemsListView {
     41      get { return itemsListView; }
     42    }
     43
    3444    public RunCollectionView() {
    3545      InitializeComponent();
    36       Caption = "RunCollection";
    37       itemsGroupBox.Text = "Runs";
    38     }
    39     /// <summary>
    40     /// Initializes a new instance of <see cref="VariablesScopeView"/> with
    41     /// the given <paramref name="scope"/>.
    42     /// </summary>
    43     /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
    44     /// <param name="scope">The scope whose variables should be represented visually.</param>
     46      Caption = "Run Collection";
     47    }
     48
    4549    public RunCollectionView(IObservableCollection<Run> content)
    4650      : this() {
     
    4852    }
    4953
    50     protected override Run CreateItem() {
    51       return new Run();
    52     }
     54    protected override void DeregisterContentEvents() {
     55      Content.ItemsAdded -= new CollectionItemsChangedEventHandler<Run>(Content_ItemsAdded);
     56      Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<Run>(Content_ItemsRemoved);
     57      Content.CollectionReset -= new CollectionItemsChangedEventHandler<Run>(Content_CollectionReset);
     58      base.DeregisterContentEvents();
     59    }
     60    protected override void RegisterContentEvents() {
     61      base.RegisterContentEvents();
     62      Content.ItemsAdded += new CollectionItemsChangedEventHandler<Run>(Content_ItemsAdded);
     63      Content.ItemsRemoved += new CollectionItemsChangedEventHandler<Run>(Content_ItemsRemoved);
     64      Content.CollectionReset += new CollectionItemsChangedEventHandler<Run>(Content_CollectionReset);
     65    }
     66
     67    protected override void OnContentChanged() {
     68      base.OnContentChanged();
     69      Caption = "Run Collection";
     70      while (itemsListView.Items.Count > 0) RemoveListViewItem(itemsListView.Items[0]);
     71      itemsListView.Enabled = false;
     72      detailsGroupBox.Enabled = false;
     73      viewHost.Content = null;
     74      removeButton.Enabled = false;
     75
     76      if (Content != null) {
     77        Caption += " (" + Content.GetType().Name + ")";
     78        itemsListView.Enabled = true;
     79        foreach (Run item in Content)
     80          AddListViewItem(CreateListViewItem(item));
     81      }
     82    }
     83
     84    protected virtual ListViewItem CreateListViewItem(Run item) {
     85      if (!itemsListView.SmallImageList.Images.ContainsKey(item.GetType().FullName))
     86        itemsListView.SmallImageList.Images.Add(item.GetType().FullName, item.ItemImage);
     87
     88      ListViewItem listViewItem = new ListViewItem();
     89      listViewItem.Text = item.ToString();
     90      listViewItem.ToolTipText = item.ItemName + ": " + item.ItemDescription;
     91      listViewItem.ImageIndex = itemsListView.SmallImageList.Images.IndexOfKey(item.GetType().FullName);
     92      listViewItem.Tag = item;
     93      return listViewItem;
     94    }
     95    protected virtual void AddListViewItem(ListViewItem listViewItem) {
     96      itemsListView.Items.Add(listViewItem);
     97      ((Run)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
     98    }
     99    protected virtual void RemoveListViewItem(ListViewItem listViewItem) {
     100      ((Run)listViewItem.Tag).ToStringChanged -= new EventHandler(Item_ToStringChanged);
     101      listViewItem.Remove();
     102    }
     103    protected virtual void UpdateListViewItem(ListViewItem listViewItem) {
     104      if (!listViewItem.Text.Equals(listViewItem.Tag.ToString())) {
     105        listViewItem.Text = listViewItem.Tag.ToString();
     106      }
     107    }
     108    protected virtual IEnumerable<ListViewItem> GetListViewItemsForItem(Run item) {
     109      foreach (ListViewItem listViewItem in itemsListView.Items) {
     110        if (((Run)listViewItem.Tag) == item)
     111          yield return listViewItem;
     112      }
     113    }
     114
     115    #region ListView Events
     116    protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
     117      removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && !Content.IsReadOnly;
     118      if (itemsListView.SelectedItems.Count == 1) {
     119        Run item = (Run)itemsListView.SelectedItems[0].Tag;
     120        detailsGroupBox.Enabled = true;
     121        viewHost.ViewType = null;
     122        viewHost.Content = item;
     123      } else {
     124        viewHost.Content = null;
     125        detailsGroupBox.Enabled = false;
     126      }
     127    }
     128    protected virtual void itemsListView_SizeChanged(object sender, EventArgs e) {
     129      if (itemsListView.Columns.Count > 0)
     130        itemsListView.Columns[0].Width = Math.Max(0, itemsListView.Width - 25);
     131    }
     132    protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) {
     133      if (e.KeyCode == Keys.Delete) {
     134        if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly) {
     135          foreach (ListViewItem item in itemsListView.SelectedItems)
     136            Content.Remove((Run)item.Tag);
     137        }
     138      }
     139    }
     140    protected virtual void itemsListView_DoubleClick(object sender, EventArgs e) {
     141      if (itemsListView.SelectedItems.Count == 1) {
     142        Run item = (Run)itemsListView.SelectedItems[0].Tag;
     143        IView view = MainFormManager.CreateDefaultView(item);
     144        if (view != null) view.Show();
     145      }
     146    }
     147    protected virtual void itemsListView_ItemDrag(object sender, ItemDragEventArgs e) {
     148      ListViewItem listViewItem = (ListViewItem)e.Item;
     149      Run item = (Run)listViewItem.Tag;
     150      DataObject data = new DataObject();
     151      data.SetData("Type", item.GetType());
     152      data.SetData("Value", item);
     153      if (Content.IsReadOnly) {
     154        DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     155      } else {
     156        DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
     157        if ((result & DragDropEffects.Move) == DragDropEffects.Move)
     158          Content.Remove(item);
     159      }
     160    }
     161    protected virtual void itemsListView_DragEnterOver(object sender, DragEventArgs e) {
     162      e.Effect = DragDropEffects.None;
     163      Type type = e.Data.GetData("Type") as Type;
     164      if ((!Content.IsReadOnly) && (type != null) && (typeof(Run).IsAssignableFrom(type))) {
     165        if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy;  // CTRL key
     166        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     167        else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link;
     168        else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy;
     169        else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move;
     170      }
     171    }
     172    protected virtual void itemsListView_DragDrop(object sender, DragEventArgs e) {
     173      if (e.Effect != DragDropEffects.None) {
     174        Run item = e.Data.GetData("Value") as Run;
     175        if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) item = (Run)item.Clone();
     176        Content.Add(item);
     177      }
     178    }
     179    #endregion
     180
     181    #region Button Events
     182    protected virtual void removeButton_Click(object sender, EventArgs e) {
     183      if (itemsListView.SelectedItems.Count > 0) {
     184        foreach (ListViewItem item in itemsListView.SelectedItems)
     185          Content.Remove((Run)item.Tag);
     186        itemsListView.SelectedItems.Clear();
     187      }
     188    }
     189    #endregion
     190
     191    #region Content Events
     192    protected virtual void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<Run> e) {
     193      if (InvokeRequired)
     194        Invoke(new CollectionItemsChangedEventHandler<Run>(Content_ItemsAdded), sender, e);
     195      else
     196        foreach (Run item in e.Items)
     197          AddListViewItem(CreateListViewItem(item));
     198    }
     199    protected virtual void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<Run> e) {
     200      if (InvokeRequired)
     201        Invoke(new CollectionItemsChangedEventHandler<Run>(Content_ItemsRemoved), sender, e);
     202      else {
     203        foreach (Run item in e.Items) {
     204          foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) {
     205            RemoveListViewItem(listViewItem);
     206            break;
     207          }
     208        }
     209      }
     210    }
     211    protected virtual void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<Run> e) {
     212      if (InvokeRequired)
     213        Invoke(new CollectionItemsChangedEventHandler<Run>(Content_CollectionReset), sender, e);
     214      else {
     215        foreach (Run item in e.OldItems) {
     216          foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) {
     217            RemoveListViewItem(listViewItem);
     218            break;
     219          }
     220        }
     221        foreach (Run item in e.Items)
     222          AddListViewItem(CreateListViewItem(item));
     223      }
     224    }
     225    #endregion
     226
     227    #region Item Events
     228    protected virtual void Item_ToStringChanged(object sender, EventArgs e) {
     229      if (InvokeRequired)
     230        Invoke(new EventHandler(Item_ToStringChanged), sender, e);
     231      else {
     232        Run item = (Run)sender;
     233        foreach (ListViewItem listViewItem in GetListViewItemsForItem(item))
     234          UpdateListViewItem(listViewItem);
     235      }
     236    }
     237    #endregion
    53238  }
    54239}
     240
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.Designer.cs

    r3260 r3277  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.components = new System.ComponentModel.Container();
    4748      System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("Parameters", System.Windows.Forms.HorizontalAlignment.Left);
    4849      System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("Results", System.Windows.Forms.HorizontalAlignment.Left);
    4950      this.parametersResultsGroupBox = new System.Windows.Forms.GroupBox();
    5051      this.splitContainer = new System.Windows.Forms.SplitContainer();
    51       this.detailsGroupBox = new System.Windows.Forms.GroupBox();
    52       this.viewHost = new HeuristicLab.Core.Views.ViewHost();
    5352      this.listView = new System.Windows.Forms.ListView();
    5453      this.nameColumnHeader = new System.Windows.Forms.ColumnHeader();
    5554      this.valueColumnHeader = new System.Windows.Forms.ColumnHeader();
     55      this.detailsGroupBox = new System.Windows.Forms.GroupBox();
     56      this.viewHost = new HeuristicLab.Core.Views.ViewHost();
     57      this.imageList = new System.Windows.Forms.ImageList(this.components);
    5658      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5759      this.parametersResultsGroupBox.SuspendLayout();
     
    101103      this.splitContainer.SplitterDistance = 177;
    102104      this.splitContainer.TabIndex = 0;
    103       //
    104       // detailsGroupBox
    105       //
    106       this.detailsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    107                   | System.Windows.Forms.AnchorStyles.Left)
    108                   | System.Windows.Forms.AnchorStyles.Right)));
    109       this.detailsGroupBox.Controls.Add(this.viewHost);
    110       this.detailsGroupBox.Location = new System.Drawing.Point(3, 3);
    111       this.detailsGroupBox.Name = "detailsGroupBox";
    112       this.detailsGroupBox.Size = new System.Drawing.Size(302, 274);
    113       this.detailsGroupBox.TabIndex = 0;
    114       this.detailsGroupBox.TabStop = false;
    115       this.detailsGroupBox.Text = "Details";
    116       //
    117       // viewHost
    118       //
    119       this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    120                   | System.Windows.Forms.AnchorStyles.Left)
    121                   | System.Windows.Forms.AnchorStyles.Right)));
    122       this.viewHost.Content = null;
    123       this.viewHost.Location = new System.Drawing.Point(6, 19);
    124       this.viewHost.Name = "viewHost";
    125       this.viewHost.Size = new System.Drawing.Size(290, 249);
    126       this.viewHost.TabIndex = 0;
    127       this.viewHost.ViewType = null;
    128105      //
    129106      // listView
     
    149126      this.listView.ShowItemToolTips = true;
    150127      this.listView.Size = new System.Drawing.Size(171, 274);
     128      this.listView.SmallImageList = this.imageList;
    151129      this.listView.Sorting = System.Windows.Forms.SortOrder.Ascending;
    152130      this.listView.TabIndex = 0;
     
    162140      //
    163141      this.valueColumnHeader.Text = "Value";
     142      //
     143      // detailsGroupBox
     144      //
     145      this.detailsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     146                  | System.Windows.Forms.AnchorStyles.Left)
     147                  | System.Windows.Forms.AnchorStyles.Right)));
     148      this.detailsGroupBox.Controls.Add(this.viewHost);
     149      this.detailsGroupBox.Location = new System.Drawing.Point(3, 3);
     150      this.detailsGroupBox.Name = "detailsGroupBox";
     151      this.detailsGroupBox.Size = new System.Drawing.Size(302, 274);
     152      this.detailsGroupBox.TabIndex = 0;
     153      this.detailsGroupBox.TabStop = false;
     154      this.detailsGroupBox.Text = "Details";
     155      //
     156      // viewHost
     157      //
     158      this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     159                  | System.Windows.Forms.AnchorStyles.Left)
     160                  | System.Windows.Forms.AnchorStyles.Right)));
     161      this.viewHost.Content = null;
     162      this.viewHost.Location = new System.Drawing.Point(6, 19);
     163      this.viewHost.Name = "viewHost";
     164      this.viewHost.Size = new System.Drawing.Size(290, 249);
     165      this.viewHost.TabIndex = 0;
     166      this.viewHost.ViewType = null;
     167      //
     168      // imageList
     169      //
     170      this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     171      this.imageList.ImageSize = new System.Drawing.Size(16, 16);
     172      this.imageList.TransparentColor = System.Drawing.Color.Transparent;
    164173      //
    165174      // RunView
     
    195204    private System.Windows.Forms.ColumnHeader valueColumnHeader;
    196205    private HeuristicLab.Core.Views.ViewHost viewHost;
     206    private System.Windows.Forms.ImageList imageList;
    197207
    198208  }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs

    r3260 r3277  
    7575
    7676    private void FillListView() {
     77      if (!listView.SmallImageList.Images.ContainsKey("Default"))
     78        listView.SmallImageList.Images.Add("Default", HeuristicLab.Common.Resources.VS2008ImageLibrary.Class);
     79
    7780      listView.Items.Clear();
    7881      if (Content != null) {
    7982        foreach (string key in Content.Parameters.Keys) {
    8083          IItem value = Content.Parameters[key];
     84          if ((value != null) && (!listView.SmallImageList.Images.ContainsKey(value.GetType().FullName)))
     85            listView.SmallImageList.Images.Add(value.GetType().FullName, value.ItemImage);
     86
    8187          ListViewItem item = new ListViewItem(new string[] { key, value != null ? value.ToString() : "-" });
    8288          item.Tag = value;
    8389          item.Group = listView.Groups["parametersGroup"];
     90          item.ImageIndex = listView.SmallImageList.Images.IndexOfKey(value != null ? value.GetType().FullName : "Default");
    8491          listView.Items.Add(item);
    8592        }
    8693        foreach (string key in Content.Results.Keys) {
    8794          IItem value = Content.Results[key];
     95          if ((value != null) && (!listView.SmallImageList.Images.ContainsKey(value.GetType().FullName)))
     96            listView.SmallImageList.Images.Add(value.GetType().FullName, value.ItemImage);
     97
    8898          ListViewItem item = new ListViewItem(new string[] { key, value != null ? value.ToString() : "-" });
    8999          item.Tag = value;
    90100          item.Group = listView.Groups["resultsGroup"];
     101          item.ImageIndex = listView.SmallImageList.Images.IndexOfKey(value != null ? value.GetType().FullName : "Default");
    91102          listView.Items.Add(item);
    92103        }
Note: See TracChangeset for help on using the changeset viewer.