/// <summary>
        /// Report removed messages to the task list.
        /// </summary>
        /// <param name="removedMessage"></param>
        /// <remarks>
        /// methods are called in this order:
        /// 1. OnValidationMessagesChanging
        /// 2. OnValidationMessageRemoved - called once for each message removed.
        /// 3. OnValidationMessageAdded - called once for each message added.
        /// 4. OnValidationMessagesChangedSummary
        /// </remarks>
        protected override void OnValidationMessageRemoved(ValidationMessage removedMessage)
        {
            if (this.TaskProvider.Tasks.Count != 0)
            {
                var task = new ProductStoreValidationTask((ProductStoreTaskValidationMessage)removedMessage);

                foreach (Task tk in this.TaskProvider.Tasks)
                {
                    var taskToRemove = tk as ProductStoreValidationTask;

                    if ((taskToRemove != null) && taskToRemove.IsMatch(task))
                    {
                        this.TaskProvider.Tasks.Remove(taskToRemove);
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Override to implement OnNavigate behavior for the supplied validation task list item.
        /// The default implementation calls DoCommand on the first item in DiagramNavigateCommands,
        /// and executes the ExplorerNavigateCommand, if available.
        /// </summary>
        /// <param name="task">Task List item</param>
        public virtual void OnNavigateToTask(ProductStoreValidationTask task)
        {
            if (task != null)
            {
                var message = task.Message as ProductStoreTaskValidationMessage;

                var list = (message != null) ? this.GetNavigationCommands(message) : null;

                if ((list != null) && (list.Count > 0))
                {
                    int num      = 0;
                    int priority = list[0].Priority;
                    for (int i = 1; i < list.Count; i++)
                    {
                        if (list[i].Priority < priority)
                        {
                            num      = i;
                            priority = list[i].Priority;
                        }
                    }
                    list[num].DoCommand();
                }
            }
        }
        /// <summary>
        /// Override to implement OnNavigate behavior for the supplied validation task list item.
        /// The default implementation calls DoCommand on the first item in DiagramNavigateCommands,
        /// and executes the ExplorerNavigateCommand, if available.
        /// </summary>
        /// <param name="task">Task List item</param>
        public virtual void OnNavigateToTask(ProductStoreValidationTask task)
        {
            if (task != null)
            {
                var message = task.Message as ProductStoreTaskValidationMessage;

                var list = (message != null) ? this.GetNavigationCommands(message) : null;

                if ((list != null) && (list.Count > 0))
                {
                    int num = 0;
                    int priority = list[0].Priority;
                    for (int i = 1; i < list.Count; i++)
                    {
                        if (list[i].Priority < priority)
                        {
                            num = i;
                            priority = list[i].Priority;
                        }
                    }
                    list[num].DoCommand();
                }
            }
        }
 /// <summary>
 /// Override to implement OnDelete behavior for the supplied validation task list item.
 /// </summary>
 /// <param name="task"></param>
 public virtual void OnDeleteTask(ProductStoreValidationTask task)
 {
 }
        /// <summary>
        /// Report removed messages to the task list.
        /// </summary>
        /// <param name="removedMessage"></param>
        /// <remarks>
        /// methods are called in this order:
        /// 1. OnValidationMessagesChanging
        /// 2. OnValidationMessageRemoved - called once for each message removed.
        /// 3. OnValidationMessageAdded - called once for each message added.
        /// 4. OnValidationMessagesChangedSummary
        /// </remarks>
        protected override void OnValidationMessageRemoved(ValidationMessage removedMessage)
        {
            if (this.TaskProvider.Tasks.Count != 0)
            {
                var task = new ProductStoreValidationTask((ProductStoreTaskValidationMessage)removedMessage);

                foreach (Task tk in this.TaskProvider.Tasks)
                {
                    var taskToRemove = tk as ProductStoreValidationTask;

                    if ((taskToRemove != null) && taskToRemove.IsMatch(task))
                    {
                        this.TaskProvider.Tasks.Remove(taskToRemove);
                        break;
                    }
                }
            }
        }
 /// <summary>
 /// Report added messages to the task list.
 /// </summary>
 /// <param name="addedMessage"></param>
 /// <remarks>
 /// methods are called in this order:
 /// 1. OnValidationMessagesChanging
 /// 2. OnValidationMessageRemoved - called once for each message removed.
 /// 3. OnValidationMessageAdded - called once for each message added.
 /// 4. OnValidationMessagesChangedSummary
 /// </remarks>
 protected override void OnValidationMessageAdded(ValidationMessage addedMessage)
 {
     var task = new ProductStoreValidationTask((ProductStoreTaskValidationMessage)addedMessage);
     this.TaskProvider.Tasks.Add(task);
 }
 /// <summary>
 /// Determines whether the specified task is match.
 /// </summary>
 /// <param name="task">The task.</param>
 /// <returns>
 /// 	<c>true</c> if the specified task is match; otherwise, <c>false</c>.
 /// </returns>
 public bool IsMatch(ProductStoreValidationTask task)
 {
     return ((task != null) && task.Message.Equals(this.Message));
 }
 /// <summary>
 /// Override to implement OnDelete behavior for the supplied validation task list item.
 /// </summary>
 /// <param name="task"></param>
 public virtual void OnDeleteTask(ProductStoreValidationTask task)
 {
 }
        /// <summary>
        /// Report added messages to the task list.
        /// </summary>
        /// <param name="addedMessage"></param>
        /// <remarks>
        /// methods are called in this order:
        /// 1. OnValidationMessagesChanging
        /// 2. OnValidationMessageRemoved - called once for each message removed.
        /// 3. OnValidationMessageAdded - called once for each message added.
        /// 4. OnValidationMessagesChangedSummary
        /// </remarks>
        protected override void OnValidationMessageAdded(ValidationMessage addedMessage)
        {
            var task = new ProductStoreValidationTask((ProductStoreTaskValidationMessage)addedMessage);

            this.TaskProvider.Tasks.Add(task);
        }
 /// <summary>
 /// Determines whether the specified task is match.
 /// </summary>
 /// <param name="task">The task.</param>
 /// <returns>
 ///     <c>true</c> if the specified task is match; otherwise, <c>false</c>.
 /// </returns>
 public bool IsMatch(ProductStoreValidationTask task)
 {
     return((task != null) && task.Message.Equals(this.Message));
 }