private void wizardControl1_Finished(object sender, System.EventArgs e)
        {
            if (TaskService == null)
            {
                TaskService = TaskService.Instance;
            }

            td.Data = TaskName;
            td.RegistrationInfo.Description = descText.Text;
            td.Triggers.Clear();
            td.Triggers.Add(trigger);
            td.Actions.Clear();
            td.Actions.Add(action);
            if (openDlgAfterCheck.Checked)
            {
                var dlg = new TaskEditDialog(TaskService, td, true, false, TaskName)
                {
                    StartPosition = FormStartPosition.CenterParent
                };
                if (dlg.ShowDialog(ParentForm) == DialogResult.OK)
                {
                    td = dlg.TaskDefinition;
                }
            }
            if (RegisterTaskOnFinish)
            {
                TaskFolder fld = TaskService.RootFolder;
                if (!string.IsNullOrEmpty(TaskFolder) && TaskService.HighestSupportedVersion.CompareTo(TaskServiceVersion.V1_1) != 0)
                {
                    fld = TaskService.GetFolder(TaskFolder);
                }
                task = fld.RegisterTaskDefinition(TaskName, td, TaskCreation.CreateOrUpdate, td.Principal.ToString(), Password, td.Principal.LogonType);
            }
        }
Пример #2
0
        private void okButton_Click(object sender, EventArgs e)
        {
            if (TaskDefinition.Actions.Count == 0)
            {
                MessageBox.Show(EditorProperties.Resources.TaskMustHaveActionsError, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (TaskDefinition.Settings.DeleteExpiredTaskAfter != TimeSpan.Zero && !TaskEditDialog.ValidateOneTriggerExpires(TaskDefinition.Triggers))
            {
                MessageBox.Show(EditorProperties.Resources.Error_TaskDeleteMustHaveExpiringTrigger, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (TaskDefinition.LowestSupportedVersion > TaskDefinition.Settings.Compatibility)
            {
                MessageBox.Show(EditorProperties.Resources.Error_TaskPropertiesIncompatibleSimple, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (RegisterTaskOnAccept)
            {
                if (Task != null && !Task.Definition.Principal.RequiresPassword())
                {
                    Task.RegisterChanges();
                }
                else
                {
                    string     user = TaskDefinition.Principal.ToString();
                    string     pwd  = null;
                    TaskFolder fld  = TaskService.GetFolder(TaskFolder);
                    if (TaskDefinition.Principal.RequiresPassword())
                    {
                        pwd = TaskEditDialog.InvokeCredentialDialog(user, this);
                        if (pwd == null)
                        {
                            //throw new System.Security.Authentication.AuthenticationException(EditorProperties.Resources.UserAuthenticationError);
                            MessageBox.Show(EditorProperties.Resources.Error_PasswordMustBeProvided, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                    Task = fld.RegisterTaskDefinition(TaskName, TaskDefinition, TaskCreation.CreateOrUpdate,
                                                      user, pwd, TaskDefinition.Principal.LogonType);
                }
            }
            DialogResult = DialogResult.OK;
            Close();
        }
Пример #3
0
        private void wizardControl1_Finished(object sender, System.EventArgs e)
        {
            bool myTS = false;

            if (TaskService == null)
            {
                TaskService = new TaskService();
                myTS        = true;
            }

            td.Data = TaskName;
            td.RegistrationInfo.Description = descText.Text;
            td.Triggers.Clear();
            td.Triggers.Add(trigger);
            td.Actions.Clear();
            td.Actions.Add(action);
            if (openDlgAfterCheck.Checked)
            {
                TaskEditDialog dlg = new TaskEditDialog();
                dlg.Editable = true;
                dlg.Initialize(TaskService, td);
                dlg.RegisterTaskOnAccept = false;
                dlg.TaskName             = TaskName;
                if (dlg.ShowDialog(ParentForm) == DialogResult.OK)
                {
                    td = dlg.TaskDefinition;
                }
            }
            if (RegisterTaskOnFinish)
            {
                TaskFolder fld = TaskService.RootFolder;
                if (!string.IsNullOrEmpty(TaskFolder) && TaskService.HighestSupportedVersion.CompareTo(new Version(1, 1)) != 0)
                {
                    fld = TaskService.GetFolder(TaskFolder);
                }
                task = fld.RegisterTaskDefinition(TaskName, td, TaskCreation.CreateOrUpdate, td.Principal.ToString(), Password, td.Principal.LogonType);
            }

            if (myTS)
            {
                TaskService = null;
            }
        }
Пример #4
0
 public void EditSchedule(ReportSchedule schedule)
 {
     try
     {
         TaskEditDialog frm = new TaskEditDialog(schedule.Task, true, true);
         frm.AvailableTabs = AvailableTaskTabs.General | AvailableTaskTabs.Actions | AvailableTaskTabs.Conditions | AvailableTaskTabs.Triggers | AvailableTaskTabs.Settings | AvailableTaskTabs.History;
         frm.ShowDialog(this);
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("Unable to edit the schedule...\r\nCheck that the 'Report Designer' has been executed with the option 'Run as administrator'\r\nOR\r\nSet the Report Designer option 'Schedule reports with current user.\r\n\r\n{0}", ex.Message));
     }
 }
 static TaskDefinition DisplayTask(TaskService ts, TaskDefinition td, bool editable)
 {
     if (editorForm == null)
         editorForm = new TaskEditDialog();
     editorForm.Editable = editable;
     editorForm.Initialize(ts, td);
     editorForm.RegisterTaskOnAccept = true;
     editorForm.AvailableTabs = AvailableTaskTabs.All;
     return (editorForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) ? editorForm.TaskDefinition : null;
 }
Пример #6
0
 /// <summary>
 /// Initializes the control for the editing of an existing <see cref="Task"/>.
 /// </summary>
 /// <param name="task">A <see cref="Task"/> instance.</param>
 public void Initialize(Task task)
 {
     if (task == null)
     {
         throw new ArgumentNullException(nameof(task));
     }
     if (!titleSet)
     {
         Text = string.Format(EditorProperties.Resources.TaskEditDlgTitle, task.Name, TaskEditDialog.GetServerString(task.TaskService));
     }
     Task = task;
 }
Пример #7
0
 /// <summary>
 /// Initializes the control for the editing of a new <see cref="TaskDefinition"/>.
 /// </summary>
 /// <param name="service">A <see cref="TaskService"/> instance.</param>
 /// <param name="td">An optional <see cref="TaskDefinition"/>. Leaving null creates a new task.</param>
 public void Initialize(TaskService service, TaskDefinition td = null)
 {
     if (service == null)
     {
         throw new ArgumentNullException(nameof(service));
     }
     if (!titleSet)
     {
         Text = string.Format(EditorProperties.Resources.TaskEditDlgTitle, "New Task", TaskEditDialog.GetServerString(service));
     }
     TaskService = service;
     task        = null;
     if (!this.IsDesignMode())
     {
         if (td == null)
         {
             var temp = service.NewTask();
             if (service.HighestSupportedVersion == new Version(1, 1))
             {
                 temp.Settings.Compatibility = TaskCompatibility.V1;
             }
             TaskDefinition = temp;
         }
         else
         {
             TaskDefinition = td;
         }
     }
 }
		private void wizardControl1_Finished(object sender, System.EventArgs e)
		{
			bool myTS = false;

			if (this.TaskService == null)
			{
				this.TaskService = new TaskService();
				myTS = true;
			}

			td.Data = TaskName;
			td.RegistrationInfo.Description = descText.Text;
			td.Triggers.Clear();
			td.Triggers.Add(trigger);
			td.Actions.Clear();
			td.Actions.Add(action);
			if (openDlgAfterCheck.Checked)
			{
				TaskEditDialog dlg = new TaskEditDialog();
				dlg.Editable = true;
				dlg.Initialize(this.TaskService, td);
				dlg.RegisterTaskOnAccept = false;
				dlg.TaskName = TaskName;
				if (dlg.ShowDialog(this.ParentForm) == System.Windows.Forms.DialogResult.OK)
					this.td = dlg.TaskDefinition;
			}
			if (RegisterTaskOnFinish)
			{
				TaskFolder fld = this.TaskService.RootFolder;
				if (!string.IsNullOrEmpty(this.TaskFolder) && TaskService.HighestSupportedVersion.CompareTo(new Version(1, 1)) != 0)
					fld = this.TaskService.GetFolder(this.TaskFolder);
				task = fld.RegisterTaskDefinition(TaskName, td, TaskCreation.CreateOrUpdate, td.Principal.ToString(), Password, td.Principal.LogonType);
			}

			if (myTS)
				this.TaskService = null;
		}
 /// <summary>
 /// Initializes the control for the editing of a new <see cref="TaskDefinition"/>.
 /// </summary>
 /// <param name="service">A <see cref="TaskService"/> instance.</param>
 /// <param name="td">An optional <see cref="TaskDefinition"/>. Leaving null creates a new task.</param>
 public void Initialize(TaskService service, TaskDefinition td = null)
 {
     if (service == null)
     {
         throw new ArgumentNullException("service");
     }
     if (!titleSet)
     {
         this.Text = string.Format(EditorProperties.Resources.TaskEditDlgTitle, "New Task", TaskEditDialog.GetServerString(service));
     }
     this.TaskService = service;
     this.task        = null;
     if (!this.IsDesignMode())
     {
         if (td == null)
         {
             this.TaskDefinition = service.NewTask();
         }
         else
         {
             this.TaskDefinition = td;
         }
     }
 }