Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 /// <param name="resourceId"></param>
 /// <param name="issues"></param>
 /// <param name="openAction"></param>
 public ValidationResultsDialog(string resourceId, ValidationIssue[] issues, Action<IResource> openAction)
     : this(new List<KeyValuePair<string, ValidationIssue[]>>(
             new KeyValuePair<string, ValidationIssue[]>[] { 
                 new KeyValuePair<string, ValidationIssue[]>(resourceId, issues) 
             }
         ),
         openAction)
 {
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
        /// <returns>
        ///     <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (!typeof(ValidationIssue).IsAssignableFrom(obj.GetType()))
            {
                return(false);
            }

            ValidationIssue vi = (ValidationIssue)obj;

            return(this.Resource.ResourceID.Equals(vi.Resource.ResourceID) &&
                   this.Message.Equals(vi.Message) &&
                   this.Status == vi.Status &&
                   this.StatusCode == vi.StatusCode);
        }
Ejemplo n.º 3
0
        protected static void CollectAndDisplayIssues(ValidationIssue[] issues)
        {
            if (issues != null)
            {
                if (issues.Length > 0)
                {
                    //Sigh! LINQ would've made this code so simple...

                    var sort = new Dictionary<string, List<ValidationIssue>>();
                    foreach (var issue in issues)
                    {
                        string resId = issue.Resource.ResourceID;
                        if (!sort.ContainsKey(resId))
                            sort[resId] = new List<ValidationIssue>();

                        sort[resId].Add(issue);
                    }

                    var groupedIssues = new List<KeyValuePair<string, ValidationIssue[]>>();
                    foreach (var kvp in sort)
                    {
                        groupedIssues.Add(
                            new KeyValuePair<string, ValidationIssue[]>(
                                kvp.Key,
                                kvp.Value.ToArray()));
                    }

                    var resDlg = new ValidationResultsDialog(groupedIssues, OpenAffectedResource);
                    resDlg.Show();
                }
                else
                {
                    MessageService.ShowMessage(Strings.ValidationNoIssues);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds the issue.
        /// </summary>
        /// <param name="issue">The issue.</param>
        public void AddIssue(ValidationIssue issue)
        {
            Check.NotNull(issue, "issue"); //NOXLATE
            Check.NotNull(issue.Resource, "issue.Resource"); //NOXLATE
            Check.NotEmpty(issue.Resource.ResourceID, "issue.Resource.ResourceID"); //NOXLATE

            if (!_issues.ContainsKey(issue.Resource.ResourceID))
                _issues[issue.Resource.ResourceID] = new Dictionary<ValidationIssue, ValidationIssue>();

            _issues[issue.Resource.ResourceID][issue] = issue;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 /// <param name="resourceId"></param>
 /// <param name="issues"></param>
 public ValidationResultsDialog(string resourceId, ValidationIssue[] issues)
     : this(resourceId, issues, null)
 {
 }