예제 #1
0
 public string start_timer(string uid, int interval, Action <PythonDictionary> callback, object state = null)
 {
     return(_schedulerService.StartTimer(uid, TimeSpan.FromMilliseconds(interval), p =>
     {
         var pythonDictionary = PythonConvert.ToPythonDictionary(p);
         pythonDictionary["timer_uid"] = uid;
         callback(pythonDictionary);
     }, state));
 }
        public string start_timer(string uid, int interval, TimerCallback callback, [DefaultParameterValue(null)] object state)
        {
            return(_schedulerService.StartTimer(uid, TimeSpan.FromMilliseconds(interval), p =>
            {
                var pythonDictionary = new PythonDictionary
                {
                    ["timer_uid"] = uid,
                    ["elapsed_millis"] = p.ElapsedMillis,
                    ["state"] = p.State
                };

                callback(pythonDictionary);
            }, state));
        }