Changeset 1598


Ignore:
Timestamp:
04/17/09 14:17:05 (12 years ago)
Author:
whackl
Message:

implemented request snapshot and abort job (##587)

Location:
trunk/sources/HeuristicLab.Hive.Server.Console/3.2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.Designer.cs

    r1581 r1598  
    7373      this.scClientControl = new System.Windows.Forms.SplitContainer();
    7474      this.lvClientControl = new System.Windows.Forms.ListView();
     75      this.contextMenuJob = new System.Windows.Forms.ContextMenuStrip(this.components);
     76      this.menuItemAbortJob = new System.Windows.Forms.ToolStripMenuItem();
     77      this.menuItemGetSnapshot = new System.Windows.Forms.ToolStripMenuItem();
    7578      this.tcManagementConsole = new System.Windows.Forms.TabControl();
    7679      this.checkBox1 = new System.Windows.Forms.CheckBox();
     
    9194      this.scClientControl.Panel2.SuspendLayout();
    9295      this.scClientControl.SuspendLayout();
     96      this.contextMenuJob.SuspendLayout();
    9397      this.tcManagementConsole.SuspendLayout();
    9498      this.SuspendLayout();
     
    490494      //
    491495      this.lvJobControl.AllowDrop = true;
     496      this.lvJobControl.ContextMenuStrip = this.contextMenuJob;
    492497      this.lvJobControl.Dock = System.Windows.Forms.DockStyle.Fill;
    493498      this.lvJobControl.LargeImageList = this.ilJobControl;
     
    498503      this.lvJobControl.TabIndex = 0;
    499504      this.lvJobControl.UseCompatibleStateImageBehavior = false;
     505      this.lvJobControl.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lvJobControl_MouseUp);
    500506      this.lvJobControl.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lvJobControl_MouseMove);
    501507      this.lvJobControl.Click += new System.EventHandler(this.OnLVJobControlClicked);
     
    543549      this.lvClientControl.UseCompatibleStateImageBehavior = false;
    544550      this.lvClientControl.Click += new System.EventHandler(this.OnLVClientClicked);
     551      //
     552      // contextMenuJob
     553      //
     554      this.contextMenuJob.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     555            this.menuItemAbortJob,
     556            this.menuItemGetSnapshot});
     557      this.contextMenuJob.Name = "contextMenuJob";
     558      this.contextMenuJob.Size = new System.Drawing.Size(151, 48);
     559      //
     560      // menuItemAbortJob
     561      //
     562      this.menuItemAbortJob.Name = "menuItemAbortJob";
     563      this.menuItemAbortJob.Size = new System.Drawing.Size(150, 22);
     564      this.menuItemAbortJob.Text = "Abort";
     565      //
     566      // menuItemGetSnapshot
     567      //
     568      this.menuItemGetSnapshot.Name = "menuItemGetSnapshot";
     569      this.menuItemGetSnapshot.Size = new System.Drawing.Size(150, 22);
     570      this.menuItemGetSnapshot.Text = "Get Snapshot";
    545571      //
    546572      // tcManagementConsole
     
    596622      this.scClientControl.Panel2.ResumeLayout(false);
    597623      this.scClientControl.ResumeLayout(false);
     624      this.contextMenuJob.ResumeLayout(false);
    598625      this.tcManagementConsole.ResumeLayout(false);
    599626      this.ResumeLayout(false);
     
    653680    private System.Windows.Forms.CheckBox checkBox1;
    654681    private System.Windows.Forms.ColumnHeader chSnapshotTime;
     682    private System.Windows.Forms.ContextMenuStrip contextMenuJob;
     683    private System.Windows.Forms.ToolStripMenuItem menuItemAbortJob;
     684    private System.Windows.Forms.ToolStripMenuItem menuItemGetSnapshot;
    655685  }
    656686}
  • trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.cs

    r1595 r1598  
    6363    public HiveServerManagementConsole() {
    6464      InitializeComponent();
     65      Init();
    6566      AddClients();
    6667      AddJobs();
     
    8687
    8788    #endregion
     89
     90    private void Init() {
     91
     92      //adding context menu items for jobs
     93      menuItemAbortJob.Click += (s, e) => {
     94        IJobManager jobManager = ServiceLocator.GetJobManager();
     95        if (lvJobControl.SelectedItems.Count == 1) {
     96          Guid jobID = Guid.Empty;
     97          jobID = (Guid)TypeDescriptor.GetConverter(jobID).ConvertFrom(lvJobControl.SelectedItems[0].Text);
     98          jobManager.AbortJob(jobID);
     99        }
     100      };
     101
     102      menuItemGetSnapshot.Click += (s, e) => {
     103        IJobManager jobManager = ServiceLocator.GetJobManager();
     104        if (lvJobControl.SelectedItems.Count == 1) {
     105          Guid jobID = Guid.Empty;
     106          jobID = (Guid)TypeDescriptor.GetConverter(jobID).ConvertFrom(lvJobControl.SelectedItems[0].Text);
     107          jobManager.RequestSnapshot(jobID);
     108        }
     109      };
     110
     111    }
     112
     113    private void lvJobControl_MouseUp(object sender, MouseEventArgs e) {
     114      // If the right mouse button was clicked and released,
     115      // display the shortcut menu assigned to the TreeView.
     116      if (e.Button == MouseButtons.Right && lvJobControl.SelectedItems.Count == 1) {
     117        lvJobControl.ContextMenuStrip.Show(new Point(e.X, e.Y));
     118      }
     119    }
    88120
    89121    /// <summary>
     
    690722    #endregion
    691723
     724
     725
     726
    692727  }
    693728}
  • trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.resx

    r1530 r1598  
    349349    <value>580, 13</value>
    350350  </metadata>
     351  <metadata name="contextMenuJob.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     352    <value>730, 13</value>
     353  </metadata>
    351354  <metadata name="updaterWoker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    352     <value>17, 50</value>
     355    <value>862, 13</value>
    353356  </metadata>
    354357</root>
Note: See TracChangeset for help on using the changeset viewer.