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);
        }
Exemplo n.º 2
0
        static void _Dispose()
        {
            if (WasTrue(ref _instance._completed))
            {
                return;
            }

            _instance.StopAllCoroutines();
            _instance._dispose.Dispose();

            Destroy(_instance.gameObject);
            _instance = null;
        }
Exemplo n.º 3
0
        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)));
                }
            }
        }
Exemplo n.º 4
0
        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));
                }
            }
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 public void StartScheduler()
 {
     ScheduleRunner.StartNewScheduler();
 }