示例#1
0
        private void WriteDataDetectorTypes(JsonWriter writer)
        {
            if (DataDetectorTypes != DataDetectorTypes.PKDataDetectorAll)
            {
                writer.WritePropertyName("dataDetectorTypes");
                writer.WriteStartArray();

                foreach (Enum value in Enum.GetValues(typeof(DataDetectorTypes)))
                {
                    if (value.CompareTo(DataDetectorTypes.PKDataDetectorNone) != 0 &&
                        value.CompareTo(DataDetectorTypes.PKDataDetectorAll) != 0 &&
                        DataDetectorTypes.HasFlag(value))
                    {
                        writer.WriteValue(value.ToString());
                    }
                }

                writer.WriteEndArray();
            }
        }
        // Dotfucated friendly enum name conversion
        // http://stackoverflow.com/questions/483794/convert-enum-to-string
        public static string ToSafeString(this DataDetectorTypes dataDetectorType)
        {
            switch (dataDetectorType)
            {
            case DataDetectorTypes.PKDataDetectorTypeAddress:
                return("PKDataDetectorTypeAddress");

            case DataDetectorTypes.PKDataDetectorTypeCalendarEvent:
                return("PKDataDetectorTypeCalendarEvent");

            case DataDetectorTypes.PKDataDetectorTypeLink:
                return("PKDataDetectorTypeLink");

            case DataDetectorTypes.PKDataDetectorTypePhoneNumber:
                return("PKDataDetectorTypePhoneNumber");

            default:
                return("");
            }
        }
示例#3
0
 public StandardField(string key, string label, string value, string attributedValue, DataDetectorTypes dataDetectorTypes)
     : this(key, label, value)
 {
     this.AttributedValue   = attributedValue;
     this.DataDetectorTypes = DataDetectorTypes.PKDataDetectorAll;
 }
		public StandardField(string key, string label, string value, string attributedValue, DataDetectorTypes dataDetectorTypes)
			: this(key, label, value)
        {
            this.AttributedValue = attributedValue;
			this.DataDetectorTypes = DataDetectorTypes.PKDataDetectorAll;
        }