Esempio n. 1
0
        /// <summary>
        /// Called when the associated control changes.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="ce">A ComponentChangedEventArgs that contains the event data. </param>
        public override void OnComponentChanged(object sender, System.ComponentModel.Design.ComponentChangedEventArgs ce)
        {
            if (ce == null)
            {
                throw new ArgumentNullException("ce");
            }

            base.OnComponentChanged(sender, ce);

            if (ce.Member.Name == "Value")
            {
                // user has edited Value property make sure the designer knows that
                // this means other properties need serializing
                TimeLabel control = (TimeLabel)this.Component;

                this.RaiseComponentChanged("TimeType", control.TimeType);

                switch (control.Value.TimeType)
                {
                case TimeType.Exact:
                case TimeType.Approximate:
                    this.RaiseComponentChanged("TimeValue", control.TimeValue);
                    break;

                case TimeType.NullIndex:
                    this.RaiseComponentChanged("NullIndex", control.NullIndex);
                    break;
                }
            }
        }
Esempio n. 2
0
        public void TimeTypeProperty()
        {
            TimeLabel testLabel = new TimeLabel();

            testLabel.TimeType = TimeType.Approximate;

            Assert.AreEqual<TimeType>(testLabel.TimeType, TimeType.Approximate);
        }       
Esempio n. 3
0
        public void ValueProperty()
        {
            NhsTime time = new NhsTime();
            TimeLabel testLabel = new TimeLabel();

            testLabel.Value = time;

            Assert.AreEqual<NhsTime>(testLabel.Value, time);
        }
Esempio n. 4
0
        public void TimeValueProperty()
        {
            DateTime baseDateTime = new DateTime(2008, 12, 12);

            TimeLabel testLabel = new TimeLabel();

            testLabel.TimeValue = baseDateTime;

            Assert.AreEqual<DateTime>(baseDateTime, testLabel.TimeValue);
        }
Esempio n. 5
0
        public void DisplaySecondsProperty()
        {
            TimeLabel testLabel = new TimeLabel();

            testLabel.DisplaySeconds = true;

            Assert.AreEqual<bool>(testLabel.DisplaySeconds, true);
        }
Esempio n. 6
0
        public void NullIndexProperty()
        {
            TimeLabel testLabel = new TimeLabel();

            testLabel.NullIndex = 2;

            Assert.AreEqual<int>(2, testLabel.NullIndex);
        }
Esempio n. 7
0
        public void DisplayAMPMProperty()
        {
            TimeLabel testLabel = new TimeLabel();

            testLabel.DisplayAMPM = true;

            Assert.AreEqual<bool>(testLabel.DisplayAMPM, true);
        }
Esempio n. 8
0
        public void Display12HourProperty()
        {
            TimeLabel testLabel = new TimeLabel();

            testLabel.Display12Hour = true;

            Assert.AreEqual<bool>(testLabel.Display12Hour, true);
        }