public static void Create() { _instance = new Immutable(); Timer = new MultimediaTimer() { Interval = 100 }; }
public static void SetupTimer(string SCORECLOCK_WIDGET) { if (Timer == null) { Timer = new MultimediaTimer() { Interval = 100 }; } millisecondclock = DEFAULT_TIME; //DrawClock(); Timer.Elapsed += (sender, args) => { millisecondclock -= Timer.Interval; DrawClock(); try { Engine.SetClockWidgetValue(SCORECLOCK_WIDGET, (int)millisecondclock); } catch { Console.WriteLine("Can't find clockwidget '" + SCORECLOCK_WIDGET + "' in graphics xpression engine."); } if (millisecondclock <= 0) { millisecondclock = 0; DrawClock(); Timer.Stop(); //if (toggle_play.Checked) //{ // toggle_play.Checked = false; //} } }; Timer.Elapsed += (sender, args) => { try { if (millisecondclock < MS_MINUTE && Engine.GetClockWidget(SCORECLOCK_WIDGET).Format != "S.Z") { Engine.GetClockWidget(SCORECLOCK_WIDGET).Format = "S.Z"; } else if (millisecondclock >= MS_MINUTE && Engine.GetClockWidget(SCORECLOCK_WIDGET).Format != "N:SS") { Engine.GetClockWidget(SCORECLOCK_WIDGET).Format = "N:SS"; Console.WriteLine("Can't find clockwidget '" + SCORECLOCK_WIDGET + "' in graphics xpression engine."); } } catch { Console.WriteLine("Can't find clockwidget '" + SCORECLOCK_WIDGET + "' in graphics xpression engine."); } }; try { Engine.GetClockWidget(SCORECLOCK_WIDGET).Format = "N:SS"; } catch { Console.WriteLine("Can't find clock widget in xpression engine."); } }