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();
        }