1 using System; 2 using System.Collections; 3 using System.Collections.Generic; 4 using System.Collections.ObjectModel; 5 using System.Text; 6 using System.Xml; 7 using System.Xml.Schema; 8 using System.IO; 9 using System.Reflection; 10 using System.Diagnostics; 11 using System.Runtime.Serialization; 12 using System.Security.Permissions; 13 using System.Globalization; 14 15 //using System.Workflow.Activities; 16 using System.Workflow.ComponentModel; 17 using System.Workflow.Runtime; 18 using System.Workflow.Runtime.Hosting; 19 using Hosting = System.Workflow.Runtime.Hosting; 20 21 22 namespace System.Workflow.Runtime.Tracking 23 { 24 [Serializable] 25 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] 26 public abstract class TrackingCondition 27 { 28 #region Properties 29 30 public abstract string Value { get; set; } 31 32 public abstract string Member { get; set; } 33 34 public abstract ComparisonOperator Operator { get; set; } 35 36 #endregion 37 38 #region Internal Abstract Match Methods 39 Match(object obj)40 internal abstract bool Match(object obj); 41 42 #endregion 43 44 } 45 46 /// <summary> 47 /// Describes critieria that is used constrain locations. 48 /// </summary> 49 [Serializable] 50 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] 51 public class ActivityTrackingCondition : TrackingCondition 52 { 53 #region Private Data Members 54 55 private string _property; 56 private string _val; 57 private ComparisonOperator _op = ComparisonOperator.Equals; 58 59 #endregion 60 61 #region Constructors 62 /// <summary> 63 /// Default constructor 64 /// </summary> ActivityTrackingCondition()65 public ActivityTrackingCondition() 66 { 67 } 68 69 /// <summary> 70 /// Constuct with a list of property names and a value. 71 /// </summary> 72 /// <param name="propertyName">"." delineated list of property names.</param> 73 /// <param name="value">Value for the condition.</param> 74 /// <remarks>Throws ArgumentNullException, ArgumentException.</remarks> ActivityTrackingCondition(string member, string value)75 public ActivityTrackingCondition(string member, string value) 76 { 77 // 78 // value can be null but the propery name(s) cannot 79 if (null == member) 80 throw new ArgumentNullException("member"); 81 82 _property = member; 83 84 SetValue(value); 85 } 86 87 #endregion 88 89 #region Properties 90 91 public override string Value 92 { 93 get { return _val; } 94 set { SetValue(value); } 95 } 96 97 public override string Member 98 { 99 get { return _property; } 100 set { _property = value; } 101 } 102 103 public override ComparisonOperator Operator 104 { 105 get { return _op; } 106 set { _op = value; } 107 } 108 109 #endregion 110 111 #region Internal Methods 112 Match(object obj)113 internal override bool Match(object obj) 114 { 115 if (null == obj) 116 throw new ArgumentNullException("obj"); 117 118 object o = PropertyHelper.GetProperty(_property, obj); 119 120 if (ComparisonOperator.Equals == _op) 121 { 122 if (null == o) 123 return (null == _val); 124 else 125 return (0 == string.Compare(o.ToString(), _val, StringComparison.Ordinal)); 126 } 127 else 128 { 129 if (null == o) 130 return (null != _val); 131 else 132 return (0 != string.Compare(o.ToString(), _val, StringComparison.Ordinal)); 133 } 134 } 135 136 #endregion 137 138 #region Private Methods 139 SetValue(string value)140 private void SetValue(string value) 141 { 142 _val = value; 143 } 144 145 #endregion 146 } 147 148 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] 149 public enum ComparisonOperator 150 { 151 Equals = 0, 152 NotEquals = 1, 153 } 154 } 155