Exemple #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;
                }
            }
        }
Exemple #2
0
        public void TimeTypeProperty()
        {
            TimeLabel testLabel = new TimeLabel();

            testLabel.TimeType = TimeType.Approximate;

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

            testLabel.Value = time;

            Assert.AreEqual<NhsTime>(testLabel.Value, time);
        }
Exemple #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);
        }
Exemple #5
0
        public void DisplaySecondsProperty()
        {
            TimeLabel testLabel = new TimeLabel();

            testLabel.DisplaySeconds = true;

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

            testLabel.NullIndex = 2;

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

            testLabel.DisplayAMPM = true;

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

            testLabel.Display12Hour = true;

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