public void Remove(AttachedComparison comparison)
        {
            if (!this.Dispatcher.CheckAccess())
            {
                this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.SystemIdle, TimeSpan.FromSeconds(1),
                  new System.Action(delegate()
                  {
                      Remove(comparison);
                  }
              ));
            }
            else
            {
                if (_attachedComparisons != null)
                {
                    AttachedComparison toRemove = null;
                    foreach (var tmp in _attachedComparisons)
                    {
                        if (tmp.Title == comparison.Title)
                        {
                            toRemove = tmp;
                        }
                    }

                    if (toRemove != null)
                    {
                        _attachedComparisons.Remove(toRemove);
                    }
                }
            }
        }
Example #2
0
		/// <summary>
		/// Parses the contents of the NamedProperties.CompareAttachment MailItem.UserProperty.
		/// 
		/// This property contains a list of the resultant comparisons of an email.
		/// </summary>
		/// <param name="compareAttachmentPropVal"></param>
		/// <returns></returns>
		public static AttachedComparison[] GetComparisons(string compareAttachmentPropVal)
		{
			List<AttachedComparison> comparisons = new List<AttachedComparison>();

            compareAttachmentPropVal = compareAttachmentPropVal.TrimEnd(';');

			foreach (string s in compareAttachmentPropVal.Split(new char[] { ';' }))
			{	
				string[] values = s.Split(new char[]{'=', '¬'});
                if (values.Length == 3)
                {
                    AttachedComparison comparison = new AttachedComparison { Title = values[0], RedlineRtfPath = values[1], RedlineMlPath = values[2] };
                    comparisons.Add(comparison);
                }
                else
                {
                    string title = values[0];
                    if (!string.IsNullOrEmpty(title))
                    {
                        AttachedComparison comparison = new AttachedComparison { Title = title };
                        comparisons.Add(comparison);
                    }
                }
			}

			return comparisons.ToArray();
		}
 public void Add(AttachedComparison comparison)
 {
     if (!this.Dispatcher.CheckAccess())
     {
         this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.SystemIdle, TimeSpan.FromSeconds(1),
           new System.Action(delegate()
           {
               Add(comparison);
           }
       ));
     }
     else
     {
         _attachedComparisons.Add(comparison);
         this.tabCtrl.ItemsSource = _attachedComparisons;
         this.tabCtrl.SelectedIndex = 0;
     }
 }