예제 #1
0
파일: NhsTime.cs 프로젝트: odnodn/mscui
        public NhsTime(string time, bool parseAll)
        {
            NhsTime newTime = NhsTime.ParseExact(time, CultureInfo.CurrentCulture);

            this.timeValue = newTime.timeValue;
            this.timeType  = newTime.timeType;
            this.nullIndex = newTime.nullIndex;
        }
예제 #2
0
        /// <summary>
        /// Converts the given object to the type of the converter using the specified context and culture information.
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that provides a format context. </param>
        /// <param name="culture">CultureInfo culture.</param>
        /// <param name="value">The Object to convert. </param>
        /// <returns>An Object that represents the converted value. </returns>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            string stringValue = value as string;

            if (stringValue != null)
            {
                return(NhsTime.ParseExact(stringValue, CultureInfo.CurrentCulture));
            }

            return(base.ConvertFrom(context, culture, value));
        }
예제 #3
0
파일: NhsTime.cs 프로젝트: odnodn/mscui
 /// <summary>
 /// Parses a string that represents a time and returns a corresponding NhsTime object.
 /// </summary>
 /// <param name="time">The time to be parsed.</param>
 /// <returns>An NhsTime object. </returns>
 /// <exception cref="System.ArgumentNullException">Time is null. </exception>
 /// <exception cref="System.FormatException">Time is not in a recognised format.</exception>
 public static NhsTime ParseExact(string time)
 {
     return(NhsTime.ParseExact(time, CultureInfo.CurrentCulture));
 }
예제 #4
0
파일: NhsTime.cs 프로젝트: odnodn/mscui
 /// <summary>
 /// Constructs an NhsTime object, uses Time.Parse to create a new temporary NhsTime object for
 /// the given string and copies the property values from the temporary NhsTime object
 /// to the new NhsTime object.
 /// </summary>
 /// <param name="time">The time as a string.</param>
 public NhsTime(string time)
 {
     this.timeType  = TimeType.Exact;
     this.timeValue = NhsTime.ParseExact(time, CultureInfo.CurrentCulture).timeValue;
 }