private void JobInformation_Load(object sender, EventArgs e)
        {
            labelJobNameTitle.Text += MyJob.Name;

            DGJob.ColumnCount   = 2;
            DGTasks.ColumnCount = 2;
            DGTasks.Columns[0].DefaultCellStyle.BackColor = Color.Gainsboro;

            DGErrors.ColumnCount           = 3;
            DGErrors.Columns[0].HeaderText = AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_Task;
            DGErrors.Columns[1].HeaderText = AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_ErrorDetail;
            DGErrors.Columns[2].HeaderText = AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_Code;

            DGJob.Columns[0].DefaultCellStyle.BackColor = Color.Gainsboro;
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_Name, MyJob.Name);
            DGJob.Rows.Add("Id", MyJob.Id);
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_State, MyJob.State);
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_Priority, MyJob.Priority);
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_OverallProgress, MyJob.GetOverallProgress());

            if (MyJob.StartTime != null)
            {
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_StartTime, ((DateTime)MyJob.StartTime).ToLocalTime().ToString("G"));
            }
            if (MyJob.EndTime != null)
            {
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_EndTime, ((DateTime)MyJob.EndTime).ToLocalTime().ToString("G"));
            }

            if ((MyJob.StartTime != null) && (MyJob.EndTime != null))
            {
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_JobDuration, ((DateTime)MyJob.EndTime).Subtract((DateTime)MyJob.StartTime));
            }
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_CPUDuration, MyJob.RunningDuration);
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_Created, ((DateTime)MyJob.Created).ToLocalTime().ToString("G"));
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_LastModified, ((DateTime)MyJob.LastModified).ToLocalTime().ToString("G"));
            DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_TemplateId, MyJob.TemplateId);


            TaskSize jobSizePrice = JobInfo.CalculateJobSizeAndPrice(MyJob);

            if ((jobSizePrice.InputSize != -1) && (jobSizePrice.OutputSize != -1))
            {
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_InputSize, AssetInfo.FormatByteSize(jobSizePrice.InputSize));
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_OutputSize, AssetInfo.FormatByteSize(jobSizePrice.OutputSize));
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_ProcessedSize, AssetInfo.FormatByteSize(jobSizePrice.InputSize + jobSizePrice.OutputSize));
                //if (jobSizePrice.Price != -1) DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_EstimatedPrice, string.Format("{0} {1:0.00}", Properties.Settings.Default.Currency, jobSizePrice.Price));
            }
            else
            {
                DGJob.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_InputOutputSize, AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_UndefinedTaskDidNotFinishOrOneOfTheAssetsHasBeenDeleted);
            }

            bool btaskinjob = (MyJob.Tasks.Count() > 0);

            if (btaskinjob)
            {
                foreach (ITask task in MyJob.Tasks)
                {
                    listBoxTasks.Items.Add(task.Name ?? Constants.stringNull);

                    for (int i = 0; i < task.ErrorDetails.Count(); i++)
                    {
                        DGErrors.Rows.Add(task.Name, task.ErrorDetails[i].Message, task.ErrorDetails[i].Code);
                    }
                }
                listBoxTasks.SelectedIndex = 0;
            }

            ListJobAssets();
        }
Exemple #2
0
        private void JobInformation_Load(object sender, EventArgs e)
        {
            labelJobNameTitle.Text += MyJob.Name;

            DGJob.ColumnCount   = 2;
            DGTasks.ColumnCount = 2;
            DGTasks.Columns[0].DefaultCellStyle.BackColor = Color.Gainsboro;


            DGErrors.ColumnCount           = 3;
            DGErrors.Columns[0].HeaderText = "Task";
            DGErrors.Columns[1].HeaderText = "Error detail";
            DGErrors.Columns[2].HeaderText = "Code";

            DGJob.Columns[0].DefaultCellStyle.BackColor = Color.Gainsboro;
            DGJob.Rows.Add("Name", MyJob.Name);
            DGJob.Rows.Add("Id", MyJob.Id);
            DGJob.Rows.Add("State", MyJob.State);
            DGJob.Rows.Add("Priority", MyJob.Priority);
            DGJob.Rows.Add("Overall progress", MyJob.GetOverallProgress());

            if (MyJob.StartTime != null)
            {
                DGJob.Rows.Add("Start Time", ((DateTime)MyJob.StartTime).ToLocalTime());
            }
            if (MyJob.EndTime != null)
            {
                DGJob.Rows.Add("End Time", ((DateTime)MyJob.EndTime).ToLocalTime());
            }

            if ((MyJob.StartTime != null) && (MyJob.EndTime != null))
            {
                DGJob.Rows.Add("Job Duration", ((DateTime)MyJob.EndTime).Subtract((DateTime)MyJob.StartTime));
            }
            DGJob.Rows.Add("CPU Duration", MyJob.RunningDuration);
            DGJob.Rows.Add("Created", ((DateTime)MyJob.Created).ToLocalTime());
            DGJob.Rows.Add("Last Modified", ((DateTime)MyJob.LastModified).ToLocalTime());
            DGJob.Rows.Add("Template Id", MyJob.TemplateId);

            string sid = "";

            if (MyJob.InputMediaAssets.Count() > 1)
            {
                sid = " #{0}";
            }
            else
            {
                sid = "";
            }
            for (int i = 0; i < MyJob.InputMediaAssets.Count(); i++)
            {
                DGJob.Rows.Add("Input asset" + string.Format(sid, i) + " Name", MyJob.InputMediaAssets[i].Name);
                DGJob.Rows.Add("Input asset" + string.Format(sid, i) + " Id", MyJob.InputMediaAssets[i].Id);
            }

            if (MyJob.OutputMediaAssets.Count() > 1)
            {
                sid = " #{0}";
            }
            else
            {
                sid = "";
            }
            for (int i = 0; i < MyJob.OutputMediaAssets.Count(); i++)
            {
                DGJob.Rows.Add("Output asset" + string.Format(sid, i) + " Name", MyJob.OutputMediaAssets[i].Name);
                DGJob.Rows.Add("Output asset" + string.Format(sid, i) + " Id", MyJob.OutputMediaAssets[i].Id);
            }


            TaskSizeAndPrice jobSizePrice = JobInfo.CalculateJobSizeAndPrice(MyJob);

            if ((jobSizePrice.InputSize != -1) && (jobSizePrice.OutputSize != -1))
            {
                DGJob.Rows.Add("Input size", AssetInfo.FormatByteSize(jobSizePrice.InputSize));
                DGJob.Rows.Add("Output size", AssetInfo.FormatByteSize(jobSizePrice.OutputSize));
                DGJob.Rows.Add("Processed size", AssetInfo.FormatByteSize(jobSizePrice.InputSize + jobSizePrice.OutputSize));
                if (jobSizePrice.Price != -1)
                {
                    DGJob.Rows.Add("Estimated price", string.Format("{0} {1:0.00}", Properties.Settings.Default.Currency, jobSizePrice.Price));
                }
            }
            else
            {
                DGJob.Rows.Add("Input/output size", "undefined, task did not finished or one of the assets has been deleted");
            }

            bool btaskinjob = (MyJob.Tasks.Count() > 0);

            if (btaskinjob)
            {
                foreach (ITask task in MyJob.Tasks)
                {
                    listBoxTasks.Items.Add(task.Name);

                    for (int i = 0; i < task.ErrorDetails.Count(); i++)
                    {
                        DGErrors.Rows.Add(task.Name, task.ErrorDetails[i].Message, task.ErrorDetails[i].Code);
                    }
                }
                listBoxTasks.SelectedIndex = 0;
            }
        }