Esempio n. 1
0
        public static int GetImageIndex16For(object o)
        {
            int num = 1;

            if (o is VmInstance)
            {
                VmInstance instance = (VmInstance)o;
                if (instance.Template)
                {
                    return(13);
                }
                if (instance.PowerState == 0)
                {
                    return(2);
                }
                if (instance.PowerState == 1)
                {
                    return(3);
                }
                if (instance.PowerState == 2)
                {
                    num = 4;
                }
                return(num);
            }
            if (o is WinAPI.SR)
            {
                return(5);
            }
            if (o is ConVpxJobInfo)
            {
                num = 6;
                ConVpxJobInfo info = (ConVpxJobInfo)o;
                if (info.State == 1)
                {
                    return(7);
                }
                if (info.State == 2)
                {
                    return(8);
                }
                if (info.State == 3)
                {
                    return(9);
                }
                if (info.State == 6)
                {
                    return(10);
                }
                if (info.State == 4)
                {
                    return(11);
                }
                if (info.State == 5)
                {
                    num = 12;
                }
            }
            return(num);
        }
Esempio n. 2
0
 public static Icons GetIconFor(ConVpxJobInfo job)
 {
     if (job.State == 1)
     {
         return(Icons.JobStateQueued);
     }
     if (job.State == 2)
     {
         return(Icons.JobStateRunning);
     }
     if (job.State == 3)
     {
         return(Icons.JobStateCompleted);
     }
     if (job.State == 6)
     {
         return(Icons.JobStateIncomplete);
     }
     if (job.State == 4)
     {
         return(Icons.JobStateAborted);
     }
     if (job.State == 5)
     {
         return(Icons.JobStateUserAborted);
     }
     return(Icons.JobStateDefault);
 }
Esempio n. 3
0
 private void dataGridViewJobs_MouseClick(object sender, MouseEventArgs e)
 {
     if ((e.Button == MouseButtons.Right) && (this.dataGridViewJobs.SelectedRows.Count > 0))
     {
         try
         {
             if (e.Button == MouseButtons.Right)
             {
                 DataGridView.HitTestInfo info = this.dataGridViewJobs.HitTest(e.X, e.Y);
                 if ((info.Type == DataGridViewHitTestType.Cell) && (this.dataGridViewJobs.Rows.Count >= 0))
                 {
                     if (!this.dataGridViewJobs.Rows[info.RowIndex].Selected)
                     {
                         this.dataGridViewJobs.CurrentCell = this.dataGridViewJobs[info.ColumnIndex, info.RowIndex];
                     }
                     this.contextMenuStrip1.Items.Clear();
                     ToolStripMenuItem item        = new ToolStripMenuItem(Messages.CANCEL_JOB_MENU_ITEM, null, new EventHandler(this.CancelMenuItemClick));
                     ToolStripMenuItem item2       = new ToolStripMenuItem(Messages.RETRY_JOB_MENU_ITEM, null, new EventHandler(this.RetryMenuItemClick));
                     ConVpxJobInfo     selectedJob = this.SelectedJob;
                     item.Enabled  = Commands.CanCancelJob(selectedJob);
                     item2.Enabled = Commands.CanRetryJob(selectedJob);
                     this.contextMenuStrip1.Items.Add(item);
                     this.contextMenuStrip1.Items.Add(new ToolStripSeparator());
                     this.contextMenuStrip1.Items.Add(item2);
                     this.contextMenuStrip1.Show(this.dataGridViewJobs, new Point(e.X, e.Y));
                 }
             }
         }
         catch (Exception exception)
         {
             LOG.Error(exception, exception);
         }
     }
 }
Esempio n. 4
0
        public static bool CanRetryJob(ConVpxJobInfo job)
        {
            bool flag = false;

            if ((job == null) || ((job.State != 5) && (job.State != 4)))
            {
                return(flag);
            }
            return(true);
        }
Esempio n. 5
0
        public static bool CanCancelJob(ConVpxJobInfo job)
        {
            bool flag = false;

            if ((job == null) || ((job.State != 2) && (job.State != 1)))
            {
                return(flag);
            }
            return(true);
        }
Esempio n. 6
0
        private void CancelMenuItemClick(object sender, EventArgs e)
        {
            List <ConVpxJobInfo> jobList     = new List <ConVpxJobInfo>();
            ConVpxJobInfo        selectedJob = this.SelectedJob;

            if ((selectedJob != null) && Helpers.Confirm(string.Format(string.Format(Messages.CANCEL_JOB_CONFIRM, selectedJob.Title), new object[0]), new object[0]))
            {
                jobList.Add(selectedJob);
                this._cancel_job_worker            = new DoCancelJobsTask(Program.ClientConnection, jobList);
                this._cancel_job_worker.Completed += new CancelJobsCompletedEventHandler(this.cancel_job_worker_Completed);
                this._cancel_job_worker.Start();
            }
        }
Esempio n. 7
0
        public static bool HasStartTS(ConVpxJobInfo job)
        {
            bool flag = true;

            if (job == null)
            {
                return(flag);
            }
            if (job.StartDateTime.Year == DateTime.MaxValue.Year)
            {
                flag = false;
            }
            return(((job.State != 0) && (job.State != 1)) && flag);
        }
Esempio n. 8
0
 public void Build(ConVpxJobInfo job)
 {
     base.SuspendLayout();
     try
     {
         this._job                        = job;
         this.IdLabel.Text                = job.JobId;
         this.StatusDetailsLabel.Text     = job.Status;             //job.StateDescription
         this.DestSRLabel.Text            = job.TargetSR;
         this.NetReadLabel.Text           = string.Format(Messages.NETWORK_READ_BYTES, ((float)job.CompressedBytesRead) / 1.073742E+09f);
         this.DiskWriteLabel.Text         = string.Format(Messages.DISK_WRITE_BYTES, ((float)job.UncompressedBytesWritten) / 1.073742E+09f);
         this.ErrorMessageValueLabel.Text = job.ErrorMessage;
         this.JobDetailsHeaderPanel.Icon  = Images.GetImage16For(job);
         if (job.ErrorMessage.Length > 0)
         {
             this.ErrorMessageValueLabel.Visible = true;
             this.ErrorMessageLabel.Visible      = true;
         }
         else
         {
             this.ErrorMessageValueLabel.Visible = false;
             this.ErrorMessageLabel.Visible      = false;
         }
         if (job.CompletedDateTime.Year != DateTime.MinValue.Year)
         {
             TimeSpan elapsed            = job.CompletedDateTime.Subtract(job.StartDateTime);
             string   durationUnitString = this.GetDurationUnitString(elapsed);
             if (!job.StartDateTime.Equals(job.CompletedDateTime))
             {
                 this.ElapsedValueLabel.Text = string.Format(Messages.ELAPSED_TIME_IN_MINUTES, elapsed, durationUnitString);
             }
             else
             {
                 this.ElapsedValueLabel.Text = "-";
             }
         }
         else
         {
             this.ElapsedValueLabel.Text = "-";
         }
     }
     catch (Exception exception)
     {
         LOG.Error(exception, exception);
     }
     base.ResumeLayout();
 }
Esempio n. 9
0
        public static bool HasCompletionTS(ConVpxJobInfo job)
        {
            bool flag = false;

            if (job != null)
            {
                if (((job.State == 3) || (job.State == 6)) || ((job.State == 4) || (job.State == 5)))
                {
                    flag = true;
                }
                if (job.CompletedDateTime.Year == DateTime.MinValue.Year)
                {
                    flag = false;
                }
            }
            return(flag);
        }
Esempio n. 10
0
 public JobRow(ConVpxJobInfo job)
 {
     if ("Incomplete".Equals(job.Status))
     {
         job.StateDisplay = "未完成";
     }
     this.JOB = job;
     for (int i = 0; i < 6; i++)
     {
         if (i == 3)
         {
             TextAndImageCell tiCell = new TextAndImageCell();
             this.UpdateJobStatusColumn(tiCell, job, i);
         }
         else
         {
             base.Cells.Add(new DataGridViewTextBoxCell());
             base.Cells[i].Value = this.GetCellText(i);
         }
     }
 }
Esempio n. 11
0
 private void UpdateJobStatusColumn(TextAndImageCell tiCell, ConVpxJobInfo job, int index)
 {
     if (job.State == 2)
     {
         long p = 0L;
         try
         {
             p = job.PercentComplete / 10L;
         }
         catch
         {
             p = 0L;
         }
         tiCell.Value = " " + job.PercentComplete.ToString() + "%";
         tiCell.Image = Images.GetProgressImage(p);
     }
     else
     {
         tiCell.Value = this.GetCellText(index);
         tiCell.Image = Images.GetImage16For(job);
     }
     base.Cells.Add(tiCell);
 }