Esempio n. 1
0
        public virtual void OnParsingDateTime(ParsingDateTimeEventArgs e)
        {
            ParsingDateTimeEventHandler parsingDateTime = this.ParsingDateTime;

            if (parsingDateTime == null)
            {
                return;
            }
            parsingDateTime((object)this, e);
        }
Esempio n. 2
0
        public void TryParse()
        {
            ParsingDateTimeEventArgs e = new ParsingDateTimeEventArgs(this.TextBoxItem.Text, this.Parser.ParseDate(this.TextBoxItem.Text, new DateTime?()));

            this.OnParsingDateTime(e);
            if (e.Cancel)
            {
                return;
            }
            DateTime?nullable1 = e.Result;
            DateTime?nullable2 = nullable1;
            DateTime minDate   = this.MinDate;

            if ((nullable2.HasValue ? (nullable2.GetValueOrDefault() < minDate ? 1 : 0) : 0) != 0)
            {
                nullable1 = new DateTime?(this.MinDate);
            }
            else
            {
                DateTime?nullable3 = nullable1;
                DateTime maxDate   = this.MaxDate;
                if ((nullable3.HasValue ? (nullable3.GetValueOrDefault() > maxDate ? 1 : 0) : 0) != 0)
                {
                    nullable1 = new DateTime?(this.MaxDate);
                }
            }
            if (nullable1.HasValue)
            {
                this.TextBoxItem.Text = nullable1.Value.ToString(this.MaskFromFormat, (IFormatProvider)this.Culture);
                this.value            = nullable1.Value;
                this.Owner.Value      = (object)nullable1.Value;
                this.List             = MaskDateTimeProvider.FillCollection(this.MaskFromFormat, this.Culture.DateTimeFormat);
                this.FillCollectionWithValues(this.List, this.value, this.Mask);
                this.SelectCurrentItemWithSelectedItem();
            }
            else
            {
                this.Owner.Value = (object)null;
            }
            this.OnParsedDateTime();
        }