private void listBoxTasks_SelectedIndexChanged(object sender, EventArgs e)
        {
            ITask task = MyJob.Tasks.Skip(listBoxTasks.SelectedIndex).Take(1).FirstOrDefault();

            DGTasks.Rows.Clear();

            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_Name, task.Name);

            int i = DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_Configuration, "");
            DataGridViewButtonCell btn = new DataGridViewButtonCell();

            DGTasks.Rows[i].Cells[1]       = btn;
            DGTasks.Rows[i].Cells[1].Value = AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_SeeClearValue;
            DGTasks.Rows[i].Cells[1].Tag   = task.GetClearConfiguration();

            i   = DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_Body, "");
            btn = new DataGridViewButtonCell();
            DGTasks.Rows[i].Cells[1]       = btn;
            DGTasks.Rows[i].Cells[1].Value = AMSExplorer.Properties.Resources.AssetInformation_DoDisplayAuthorizationPolicyOption_SeeValue;
            DGTasks.Rows[i].Cells[1].Tag   = task.TaskBody;

            DGTasks.Rows.Add("Id", task.Id);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_State, task.State);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_Priority, task.Priority);
            if (task.StartTime != null)
            {
                DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_StartTime, ((DateTime)task.StartTime).ToLocalTime().ToString("G"));
            }
            if (task.EndTime != null)
            {
                DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_JobInformation_Load_EndTime, ((DateTime)task.EndTime).ToLocalTime().ToString("G"));
            }
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.DataGridViewIngestManifest_Init_Progress, task.Progress);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_Duration, task.RunningDuration);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_PerfMessage, task.PerfMessage);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_EncryptionKeyId, task.EncryptionKeyId);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_EncryptionScheme, task.EncryptionScheme);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_EncryptionVersion, task.EncryptionVersion);

            // let's get the name of the processor
            IMediaProcessor processor = JobInfo.GetMediaProcessorFromId(task.MediaProcessorId, _context);

            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_MediaprocessorId, task.MediaProcessorId);
            if (processor != null)
            {
                DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_MediaprocessorName, processor.Name);
            }

            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.AssetInformation_DoDisplayFileProperties_Options, task.Options);
            DGTasks.Rows.Add(AMSExplorer.Properties.Resources.JobInformation_listBoxTasks_SelectedIndexChanged_InitializationVector, task.InitializationVector);

            string sid = "";

            try
            {
                if (task.InputAssets.Count() > 1)
                {
                    sid = " #{0}";
                }
                else
                {
                    sid = "";
                }
                for (int j = 0; j < task.InputAssets.Count(); j++)
                {
                    var s = string.Format(sid, j + 1);
                    DGTasks.Rows.Add(string.Format("Input asset{0} Name", s), task.InputAssets[j].Name);
                    DGTasks.Rows.Add(string.Format("Input asset{0} Id", s), task.InputAssets[j].Id);
                }
            }
            catch
            {
                DGTasks.Rows.Add("Input asset(s)", "<error, deleted?>");
            }

            try
            {
                if (task.OutputAssets.Count() > 1)
                {
                    sid = " #{0}";
                }
                else
                {
                    sid = "";
                }
                for (int j = 0; j < task.OutputAssets.Count(); j++)
                {
                    var s = string.Format(sid, j + 1);
                    DGTasks.Rows.Add(string.Format("Output asset{0} Name", s), task.OutputAssets[j].Name);
                    DGTasks.Rows.Add(string.Format("Output asset{0} Id", s), task.OutputAssets[j].Id);
                    DGTasks.Rows.Add(string.Format("Output asset{0} Format Option", s), task.OutputAssets[j].FormatOption);
                }
            }
            catch
            {
                DGTasks.Rows.Add("Output asset(s)", "<error, deleted?>");
            }

            TaskSizeAndPrice taskSizePrice = JobInfo.CalculateTaskSizeAndPrice(task, _context);

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

            for (int j = 0; j < task.ErrorDetails.Count(); j++)
            {
                DGTasks.Rows.Add("Error", task.ErrorDetails[j].Code + ": " + task.ErrorDetails[j].Message);
            }
        }
Exemplo n.º 2
0
        private void listBoxTasks_SelectedIndexChanged(object sender, EventArgs e)
        {
            ITask task = MyJob.Tasks.Skip(listBoxTasks.SelectedIndex).Take(1).FirstOrDefault();

            DGTasks.Rows.Clear();

            DGTasks.Rows.Add("Name", task.Name);
            DGTasks.Rows.Add("Id", task.Id);
            DGTasks.Rows.Add("State", task.State);
            DGTasks.Rows.Add("Priority", task.Priority);
            if (task.StartTime != null)
            {
                DGTasks.Rows.Add("Start Time", ((DateTime)task.StartTime).ToLocalTime());
            }
            if (task.EndTime != null)
            {
                DGTasks.Rows.Add("End Time", ((DateTime)task.EndTime).ToLocalTime());
            }
            DGTasks.Rows.Add("Progress", task.Progress);
            DGTasks.Rows.Add("Duration", task.RunningDuration);
            DGTasks.Rows.Add("Perf Message", task.PerfMessage);
            DGTasks.Rows.Add("Configuration", task.Configuration);
            DGTasks.Rows.Add("Encryption Key Id", task.EncryptionKeyId);
            DGTasks.Rows.Add("Encryption Scheme", task.EncryptionScheme);
            DGTasks.Rows.Add("Encryption Version", task.EncryptionVersion);

            // let's get the name of the processor
            IMediaProcessor processor = JobInfo.GetMediaProcessorFromId(task.MediaProcessorId, _context);

            DGTasks.Rows.Add("Mediaprocessor Id", task.MediaProcessorId);
            if (processor != null)
            {
                DGTasks.Rows.Add("Mediaprocessor Name", processor.Name);
            }


            DGTasks.Rows.Add("Task Body", task.TaskBody);
            DGTasks.Rows.Add("Options", task.Options);
            DGTasks.Rows.Add("Initialization Vector", task.InitializationVector);

            string sid = "";

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

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

            TaskSizeAndPrice taskSizePrice = JobInfo.CalculateTaskSizeAndPrice(task, _context);

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

            for (int i = 0; i < task.ErrorDetails.Count(); i++)
            {
                DGTasks.Rows.Add("Error", task.ErrorDetails[i].Code + ": " + task.ErrorDetails[i].Message);
            }
            textBoxConfiguration.Text = task.GetClearConfiguration();
        }