private void Button_Click(object sender, RoutedEventArgs e) { action = new Action <string>(ShowMessage); actionWithoutParameters = new Action(ShowMessageWithoutParam); ScheduleRunner sr = new ScheduleRunner(); sr.runCodeAt(DateTime.Now.AddSeconds(2.0), actionWithoutParameters, null); sr.runCodeAt <string>(DateTime.Now.AddSeconds(2.0), action, "Testowa wiadomosc", null); //SetSuspendState(false, true, true); }
static void _Dispose() { if (WasTrue(ref _instance._completed)) { return; } _instance.StopAllCoroutines(); _instance._dispose.Dispose(); Destroy(_instance.gameObject); _instance = null; }
public void currentTest() { AppSettings conf = new AppSettings(); conf.Hourpattern = "*"; conf.Minutepattern = "00,30"; ScheduleRunner uut = new ScheduleRunner(conf); DateTime t = DateTime.UtcNow.Date; for (int i = 0; i < 24; i++) { for (int m = 0; m <= 30; m += 30) { DateTime x = t.AddHours(i).AddMinutes(m); Assert.AreEqual(x, uut.current(x.AddMinutes(30))); } } }
public void nextTest() { AppSettings conf = new AppSettings(); conf.Hourpattern = "*"; conf.Minutepattern = "00,30"; ScheduleRunner uut = new ScheduleRunner(conf); DateTime t = new DateTime(2015, 1, 1, 0, 0, 0, DateTimeKind.Utc); for (int i = 0; i < 24; i++) { for (int m = 0; m <= 30; m += 30) { DateTime x = t.AddHours(i).AddMinutes(m); Assert.AreEqual(x.AddMinutes(30), uut.next(x)); } } }
static bool _TryInit(Option <ScheduleSettings> settings = default) { if (_instance) { return(false); } Application.quitting += _Dispose; var go = new GameObject { name = "Schedulers" }; _instance = go.AddComponent <ScheduleRunner>(); _instance.transform.SetParent(null, false); DontDestroyOnLoad(go); _instance._Init(settings.ValueOr(new ScheduleSettings())); return(true); }
public void StartScheduler() { ScheduleRunner.StartNewScheduler(); }