예제 #1
0
        private void ValueTextBox_Leave(object sender, EventArgs e)
        {
            NhsTime time;

            if (NhsTime.TryParseExact(this.valueTextBox.Text, out time, CultureInfo.CurrentCulture))
            {
                this.value = time;

                if (this.value.TimeType == TimeType.Exact && this.approxCheckbox.Checked)
                {
                    this.value.TimeType = TimeType.Approximate;
                }
            }

            this.valueTextBox.Text = this.value.ToString(false);

            if (this.value.TimeType != TimeType.Approximate)
            {
                this.approxCheckbox.Checked = false;
            }
        }
예제 #2
0
파일: NhsTime.cs 프로젝트: odnodn/mscui
 /// <summary>
 /// Parses a string that represents a time.
 /// </summary>
 /// <param name="time">A string containing the value to be parsed. </param>
 /// <param name="result">A container for a successfully-parsed time. </param>
 /// <returns>True if time string was successfully parsed; otherwise, false. </returns>
 /// <remarks>If the string be parsed, the result parameter is set to an NhsTime object corresponding to the parsed timeString.
 /// If the time string cannot be parsed, the result parameter is set to DateTime.MinValue. </remarks>
 public static bool TryParseExact(string time, out NhsTime result)
 {
     return(NhsTime.TryParseExact(time, out result, CultureInfo.CurrentCulture));
 }