예제 #1
0
        private string[] LVIItemsFromTask(Task task)
        {
            bool           disabled = task.State == TaskState.Disabled;
            TaskDefinition td       = null;

            try { td = task.Definition; } catch { }
            return(new string[] {
                task.Name,
                TaskEnumGlobalizer.GetString(task.State),
                td == null ? "" : task.Definition.Triggers.ToString(),
                disabled || task.NextRunTime < DateTime.Now ? string.Empty : task.NextRunTime.ToString("G"),
                task.LastRunTime == DateTime.MinValue ? EditorProperties.Resources.Never :  task.LastRunTime.ToString("G"),
                task.LastRunTime == DateTime.MinValue ? string.Empty : task.State == TaskState.Running ? string.Format(EditorProperties.Resources.LastResultRunning, task.LastTaskResult) : ((task.LastTaskResult == 0 ? EditorProperties.Resources.LastResultSuccessful : string.Format("(0x{0:X})", task.LastTaskResult))),
                td == null ? "" : task.Definition.RegistrationInfo.Author,
                string.Empty
            });
        }
예제 #2
0
        /// <summary>
        /// Initializes the check list from an enumerated type defined in the TaskScheduler assembly
        /// </summary>
        /// <param name="enumType">The enumerated type.</param>
        public void InitializeFromTaskEnum(Type enumType)
        {
            checkedListBox1.BeginUpdate();
            checkedListBox1.Items.Clear();
            long  allVal = 0;
            Array vals   = Enum.GetValues(enumType);

            for (int i = 0; i < vals.Length; i++)
            {
                long val = Convert.ToInt64(vals.GetValue(i));
                allVal |= val;
                string text = TaskEnumGlobalizer.GetString(vals.GetValue(i));
                checkedListBox1.Items.Add(new DropDownCheckListItem(text, val));
            }
            if (!string.IsNullOrEmpty(CheckAllText))
            {
                checkedListBox1.Items.Insert(0, new DropDownCheckListItem(CheckAllText, allVal));
            }
            checkedListBox1.EndUpdate();
        }
        private void summaryPage_Initialize(object sender, AeroWizard.WizardPageInitEventArgs e)
        {
            summaryPrompt.Visible = RegisterTaskOnFinish;
            if (SummaryRegistrationNotice != null)
            {
                summaryPrompt.Text = SummaryRegistrationNotice;
            }
            openDlgAfterCheck.Visible = AllowEditorOnFinish;
            if (EditorOnFinishText != null)
            {
                openDlgAfterCheck.Text = EditorOnFinishText;
            }
            string fmt = string.IsNullOrEmpty(SummaryFormatString) ? EditorProperties.Resources.WizardSummaryFormatString : SummaryFormatString;

            sumText.Text = string.Format(fmt,
                                         nameText.Text,
                                         descText.Text,
                                         trigger.ToString(),
                                         TaskEnumGlobalizer.GetString(action.ActionType) + ": " + action.ToString());
            sumText.Select(0, 0);
        }
예제 #4
0
        private string[] LVIItemsFromTask(Task task)
        {
            bool           disabled = task.State == TaskState.Disabled;
            TaskDefinition td       = null;

            try { td = task.Definition; } catch { }
            return(new string[] {
                task.Name,
                TaskEnumGlobalizer.GetString(task.State),
                td == null ? "" : task.Definition.Triggers.ToString(),
                disabled || task.NextRunTime < DateTime.Now ? string.Empty : task.NextRunTime.ToString("G"),
                task.LastRunTime == DateTime.MinValue ? EditorProperties.Resources.Never :  task.LastRunTime.ToString("G"),
                task.LastRunTime == DateTime.MinValue ? string.Empty : LastResultString(),
                td == null ? "" : task.Definition.RegistrationInfo.Author,
                string.Empty
            });

            string LastResultString()
            {
                if (task.State == TaskState.Running)
                {
                    return(string.Format(EditorProperties.Resources.LastResultRunning, task.LastTaskResult));
                }
                if (task.LastTaskResult == 0)
                {
                    return(EditorProperties.Resources.LastResultSuccessful);
                }
                var exc = new Win32Exception(task.LastTaskResult);

                if (string.IsNullOrEmpty(exc.Message))
                {
                    return(string.Format("(0x{0:X})", task.LastTaskResult));
                }
                return(exc.Message.IndexOf(task.LastTaskResult.ToString("X"), StringComparison.InvariantCultureIgnoreCase) == -1 ? string.Format("{1} (0x{0:X})", task.LastTaskResult, exc.Message) : exc.Message);
            }
        }