/// <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; } } }
public void TimeTypeProperty() { TimeLabel testLabel = new TimeLabel(); testLabel.TimeType = TimeType.Approximate; Assert.AreEqual<TimeType>(testLabel.TimeType, TimeType.Approximate); }
public void ValueProperty() { NhsTime time = new NhsTime(); TimeLabel testLabel = new TimeLabel(); testLabel.Value = time; Assert.AreEqual<NhsTime>(testLabel.Value, time); }
public void TimeValueProperty() { DateTime baseDateTime = new DateTime(2008, 12, 12); TimeLabel testLabel = new TimeLabel(); testLabel.TimeValue = baseDateTime; Assert.AreEqual<DateTime>(baseDateTime, testLabel.TimeValue); }
public void DisplaySecondsProperty() { TimeLabel testLabel = new TimeLabel(); testLabel.DisplaySeconds = true; Assert.AreEqual<bool>(testLabel.DisplaySeconds, true); }
public void NullIndexProperty() { TimeLabel testLabel = new TimeLabel(); testLabel.NullIndex = 2; Assert.AreEqual<int>(2, testLabel.NullIndex); }
public void DisplayAMPMProperty() { TimeLabel testLabel = new TimeLabel(); testLabel.DisplayAMPM = true; Assert.AreEqual<bool>(testLabel.DisplayAMPM, true); }
public void Display12HourProperty() { TimeLabel testLabel = new TimeLabel(); testLabel.Display12Hour = true; Assert.AreEqual<bool>(testLabel.Display12Hour, true); }