Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7317 for branches


Ignore:
Timestamp:
01/11/12 17:14:36 (13 years ago)
Author:
spimming
Message:

#1680:

  • Use IItemLists for data
  • Show CloudResourceView in HiveCloudManagerView
Location:
branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/CloudManagerClient.cs

    r7299 r7317  
    1919
    2020    #region Properties
    21     private ItemCollection<Subscription> subscriptions;
    22     public ItemCollection<Subscription> Subscriptions {
     21    private IItemList<Subscription> subscriptions;
     22    public IItemList<Subscription> Subscriptions {
    2323      get { return subscriptions; }
    2424      set {
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/CloudResourcesView.Designer.cs

    r7299 r7317  
    2626      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CloudResourcesView));
    2727      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
    28       this.label1 = new System.Windows.Forms.Label();
     28      this.lblRefresh = new System.Windows.Forms.Label();
    2929      this.btnSave = new System.Windows.Forms.Button();
    3030      this.btnDelete = new System.Windows.Forms.Button();
     
    4545      // splitContainer1.Panel1
    4646      //
    47       this.splitContainer1.Panel1.Controls.Add(this.label1);
     47      this.splitContainer1.Panel1.Controls.Add(this.lblRefresh);
    4848      this.splitContainer1.Panel1.Controls.Add(this.btnSave);
    4949      this.splitContainer1.Panel1.Controls.Add(this.btnDelete);
     
    5555      this.splitContainer1.TabIndex = 0;
    5656      //
    57       // label1
     57      // lblRefresh
    5858      //
    59       this.label1.AutoSize = true;
    60       this.label1.Location = new System.Drawing.Point(127, 10);
    61       this.label1.Name = "label1";
    62       this.label1.Size = new System.Drawing.Size(126, 13);
    63       this.label1.TabIndex = 5;
    64       this.label1.Text = "Done. 5s to  next refresh.";
     59      this.lblRefresh.AutoSize = true;
     60      this.lblRefresh.Location = new System.Drawing.Point(127, 10);
     61      this.lblRefresh.Name = "lblRefresh";
     62      this.lblRefresh.Size = new System.Drawing.Size(126, 13);
     63      this.lblRefresh.TabIndex = 5;
     64      this.lblRefresh.Text = "Done. 5s to  next refresh.";
    6565      //
    6666      // btnSave
    6767      //
    68       this.btnSave.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb;
     68      this.btnSave.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.Image")));
    6969      this.btnSave.Location = new System.Drawing.Point(97, 4);
    7070      this.btnSave.Name = "btnSave";
     
    7575      // btnDelete
    7676      //
    77       this.btnDelete.Image = HeuristicLab.Common.Resources.VSImageLibrary.Delete;
     77      this.btnDelete.Image = ((System.Drawing.Image)(resources.GetObject("btnDelete.Image")));
    7878      this.btnDelete.Location = new System.Drawing.Point(66, 4);
    7979      this.btnDelete.Name = "btnDelete";
     
    8484      // btnAddSlaveService
    8585      //
    86       this.btnAddSlaveService.Image = HeuristicLab.Common.Resources.VSImageLibrary.NewDocument;
     86      this.btnAddSlaveService.Image = ((System.Drawing.Image)(resources.GetObject("btnAddSlaveService.Image")));
    8787      this.btnAddSlaveService.Location = new System.Drawing.Point(35, 4);
    8888      this.btnAddSlaveService.Name = "btnAddSlaveService";
     
    9393      // btnAddSubscription
    9494      //
    95       this.btnAddSubscription.Image = HeuristicLab.Common.Resources.VSImageLibrary.NewFolder;
     95      this.btnAddSubscription.Image = ((System.Drawing.Image)(resources.GetObject("btnAddSubscription.Image")));
    9696      this.btnAddSubscription.Location = new System.Drawing.Point(4, 4);
    9797      this.btnAddSubscription.Name = "btnAddSubscription";
     
    102102      // treeCloudResources
    103103      //
     104      this.treeCloudResources.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     105            | System.Windows.Forms.AnchorStyles.Left)
     106            | System.Windows.Forms.AnchorStyles.Right)));
    104107      this.treeCloudResources.Location = new System.Drawing.Point(3, 34);
    105108      this.treeCloudResources.Name = "treeCloudResources";
     
    130133    private System.Windows.Forms.Button btnDelete;
    131134    private System.Windows.Forms.Button btnAddSlaveService;
    132     private System.Windows.Forms.Label label1;
     135    private System.Windows.Forms.Label lblRefresh;
    133136  }
    134137}
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/CloudResourcesView.cs

    r7281 r7317  
    11using System;
    2 using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Drawing;
    5 using System.Data;
    6 using System.Linq;
    7 using System.Text;
     2using System.Diagnostics;
     3using System.Threading;
     4using System.Timers;
    85using System.Windows.Forms;
     6using HeuristicLab.Clients.Hive.CloudManager.Model;
     7using HeuristicLab.Core;
     8using HeuristicLab.Core.Views;
     9using HeuristicLab.MainForm;
    910
    1011namespace HeuristicLab.Clients.Hive.CloudManager.Views {
    11   public partial class CloudResourcesView : UserControl {
     12  [View("Cloud Resources View")]
     13  [Content(typeof(IItemList<Subscription>), IsDefaultView = true)]
     14  public partial class CloudResourcesView : ItemView, IDisposable {
     15    private System.Timers.Timer timer = new System.Timers.Timer();
     16    private int updateInterval = 15000;
     17    private DateTime dueTime;
     18
     19    public new IItemList<Subscription> Content {
     20      get { return (IItemList<Subscription>)base.Content; }
     21      set { base.Content = value; }
     22    }
     23
    1224    public CloudResourcesView() {
    1325      InitializeComponent();
     26
     27      CloudManagerClient.Instance.Refreshing += new EventHandler(Instance_Refreshing);
     28      CloudManagerClient.Instance.Refreshed += new EventHandler(Instance_Refreshed);
     29
     30      timer.AutoReset = true;
     31      timer.Interval = 1000;
     32      timer.Elapsed += PerformUpdate;
     33      timer.Start();
     34      dueTime = DateTime.Now.AddMilliseconds(updateInterval);
     35    }
     36
     37    public new void Dispose() {
     38      CloudManagerClient.Instance.Refreshing -= new EventHandler(Instance_Refreshing);
     39      CloudManagerClient.Instance.Refreshed -= new EventHandler(Instance_Refreshed);
     40      timer.Dispose();
     41      Debug.WriteLine("Dispose");
     42    }
     43
     44    void Instance_Refreshing(object sender, EventArgs e) {
     45      Debug.WriteLine("Instance_Refreshing");
     46    }
     47
     48    void Instance_Refreshed(object sender, EventArgs e) {
     49      Debug.WriteLine("Instance_Refreshed");
     50    }
     51
     52    private void PerformUpdate(object sender, ElapsedEventArgs e) {
     53      TimeSpan timeToRefresh = dueTime - DateTime.Now;
     54
     55      if (timeToRefresh.Seconds >= 0) {
     56        this.Invoke((MethodInvoker)delegate { lblRefresh.Text = "Done. " + timeToRefresh.Seconds + "s to next refresh."; });
     57      } else {
     58        timer.Stop();
     59        this.Invoke((MethodInvoker)delegate { lblRefresh.Text = "Refreshing data ..."; });
     60
     61        // statistics
     62        Debug.WriteLine("perform update");
     63        Thread.Sleep(1000);
     64
     65        dueTime = DateTime.Now.AddMilliseconds(updateInterval);
     66        timer.Start();
     67      }
    1468    }
    1569  }
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Views/HiveCloudManagerView.Designer.cs

    r7281 r7317  
    2626      this.tabResources = new System.Windows.Forms.TabControl();
    2727      this.tabResource = new System.Windows.Forms.TabPage();
     28      this.cloudResourcesView = new HeuristicLab.Clients.Hive.CloudManager.Views.CloudResourcesView();
    2829      this.tabResources.SuspendLayout();
     30      this.tabResource.SuspendLayout();
    2931      this.SuspendLayout();
    3032      //
     
    4345      // tabResource
    4446      //
     47      this.tabResource.Controls.Add(this.cloudResourcesView);
    4548      this.tabResource.Location = new System.Drawing.Point(4, 22);
    4649      this.tabResource.Name = "tabResource";
     
    5053      this.tabResource.Text = "Resources";
    5154      this.tabResource.UseVisualStyleBackColor = true;
     55      //
     56      // cloudResourcesView
     57      //
     58      this.cloudResourcesView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     59            | System.Windows.Forms.AnchorStyles.Left)
     60            | System.Windows.Forms.AnchorStyles.Right)));
     61      this.cloudResourcesView.Caption = "Cloud Resources View";
     62      this.cloudResourcesView.Content = null;
     63      this.cloudResourcesView.Location = new System.Drawing.Point(6, 3);
     64      this.cloudResourcesView.Name = "cloudResourcesView";
     65      this.cloudResourcesView.ReadOnly = false;
     66      this.cloudResourcesView.Size = new System.Drawing.Size(719, 505);
     67      this.cloudResourcesView.TabIndex = 0;
    5268      //
    5369      // HiveCloudManagerView
     
    5975      this.Size = new System.Drawing.Size(745, 546);
    6076      this.tabResources.ResumeLayout(false);
     77      this.tabResource.ResumeLayout(false);
    6178      this.ResumeLayout(false);
    6279
     
    6784    private System.Windows.Forms.TabControl tabResources;
    6885    private System.Windows.Forms.TabPage tabResource;
     86    private CloudResourcesView cloudResourcesView;
    6987  }
    7088}
Note: See TracChangeset for help on using the changeset viewer.