/// <summary> /// Inits the display listeners. /// </summary> private void InitDisplayListeners() { display.OnModeButtonPress += new OnButtonPress(() => { modeSwitcher.NextMode(); modeSwitcher.GetCurrentMode().ForceScreenUpdate(); }); // Calls always the button code that belongs to the current component. display.OnPrimaryButtonPress += new OnButtonPress(() => modeSwitcher.GetCurrentMode().PrimaryButtonPress()); display.OnPrimaryLongButtonPress += new OnButtonPress(() => modeSwitcher.GetCurrentMode().PrimaryButtonLongPress()); display.OnSecondaryButtonPress += new OnButtonPress(() => modeSwitcher.GetCurrentMode().SecondaryButtonPress()); }
/// <summary> /// Initializes a new instance of the <see cref="DigitalWatch.Watches.BasicWatch"/> class. /// </summary> /// <param name="watchDisplay">Watch display.</param> /// <param name="watchComponents">Watch components.</param> public BasicWatch(Display watchDisplay, WatchComponent[] watchComponents) { modeSwitcher = new SmartModeSwitcher <WatchComponent>(); modeSwitcher.AddModes(watchComponents); display = watchDisplay; InitDisplayListeners(); InitComponentListeners(watchComponents); modeSwitcher.GetCurrentMode().ForceScreenUpdate(); }