Beispiel #1
0
        /// <summary>
        /// Closes the application configuration.
        /// </summary>
        /// <param name="node">
        /// The node to execute the command upon.
        /// </param>
        protected override void ExecuteCore(ConfigurationNode node)
        {
            try
            {
                UIService.BeginUpdate();

                if (UIService.IsDirty(node.Hierarchy))
                {
                    DialogResult result = UIService.ShowMessage(Resources.SaveApplicationRequest, Resources.SaveApplicationCaption, MessageBoxButtons.YesNo);
                    if (DialogResult.Yes == result)
                    {
                        if (!TryAndSaveApplication(node))
                        {
                            return;
                        }
                    }
                }
                if (ErrorLogService.ConfigurationErrorCount > 0)
                {
                    UIService.DisplayErrorLog(ErrorLogService);
                    DialogResult result = UIService.ShowMessage(Resources.SaveApplicationErrorRequestMessage, Resources.SaveApplicationCaption, MessageBoxButtons.YesNo);
                    if (result == DialogResult.No)
                    {
                        return;
                    }
                }
                ConfigurationUIHierarchyService.RemoveHierarchy(node.Hierarchy.Id);
            }
            finally
            {
                UIService.EndUpdate();
            }
        }
        /// <summary>
        /// <para>
        /// Executes the validation for the current node and all the child nodes.
        /// </para>
        /// </summary>
        /// <param name="node">
        /// <para>The <see cref="ConfigurationNode"/> to validate.</para>
        /// </param>
        protected override void ExecuteCore(ConfigurationNode node)
        {
            ValidationErrorCollection errors = new ValidationErrorCollection();

            Validate(node, errors);
            if (errors.Count > 0)
            {
                foreach (ValidationError error in errors)
                {
                    ConfigurationErrorLogService.LogError(error);
                }
            }
            if (ConfigurationErrorLogService.ValidationErrors.Count > 0)
            {
                if (ConfigurationErrorLogService.ValidationErrors.Count > 0)
                {
                    UIService.DisplayErrorLog(ConfigurationErrorLogService);
                }

                if (reportErrorsOnFailure)
                {
                    UIService.ShowMessage(SR.ValidationErrorsMessage, SR.ValidationCaption);
                }
                ConfigurationErrorLogService.ClearErrorLog();
                validationSucceeded = false;
            }
            else
            {
                validationSucceeded = true;
            }
        }
 private bool CheckAndDisplayErrors()
 {
     saveSucceeded = true;
     if (ErrorLogService.ConfigurationErrorCount > 0)
     {
         UIService.DisplayErrorLog(ErrorLogService);
         UIService.ShowError(Resources.SaveApplicationErrorMessage, Resources.SaveApplicationCaption);
         saveSucceeded = false;
     }
     return(saveSucceeded);
 }
Beispiel #4
0
 /// <summary>
 /// Opens a previously saved configuration.
 /// </summary>
 /// <param name="node">
 /// The node to execute the command upon.
 /// </param>
 protected override void ExecuteCore(ConfigurationNode node)
 {
     try
     {
         UIService.BeginUpdate();
         OpenFile(node);
         if (ErrorLogService.ConfigurationErrorCount > 0)
         {
             UIService.DisplayErrorLog(ErrorLogService);
         }
     }
     finally
     {
         UIService.EndUpdate();
     }
 }
 /// <summary>
 /// Opens a previously saved configuration.
 /// </summary>
 /// <param name="node">
 /// The node to execute the command upon.
 /// </param>
 protected override void ExecuteCore(ConfigurationNode node)
 {
     try
     {
         UIService.BeginUpdate();
         OpenFile();
         if (ErrorLogService.ConfigurationErrorCount > 0)
         {
             UIService.DisplayErrorLog(ErrorLogService);
             UIService.ShowMessage(Resources.OpenApplicationErrorMessage, Resources.OpenApplicationCaption);
         }
     }
     finally
     {
         UIService.EndUpdate();
     }
 }