Exemplo n.º 1
0
        private void Annoucement(string msg)
        {
            //ammend again after update the website
            if (msg == null)
            {
                return;
            }

            if (msg == "DeleteToday")
            {
                TelepresenceScheduler.DeleteToday();
                return;
            }
            else if (msg == "DeleteDaily")
            {
                TelepresenceScheduler.DeleteDailyAnnouncement();
                return;
            }

            string startTimeType = msg.Split('/')[1];
            string command       = msg.Split('/')[0];
            int    loopsCount    = int.Parse(msg.Split('/')[3]);
            int    interval      = int.Parse(msg.Split('/')[4]);

            int hour, min, sec;

            if (startTimeType == "Immediate")
            {
                SpeechGeneration.SpeakAsync(command);
                DateTime now = DateTime.Now;
                hour = now.Hour;
                min  = now.Minute;
                sec  = now.Second;
            }
            else
            {
                string startTime = msg.Split('/')[2];
                hour = int.Parse(startTime.Split(':')[0]);
                min  = int.Parse(startTime.Split(':')[1]);
                sec  = 0;
            }

            Action action = new Action(() =>
            {
                SpeechGeneration.SpeakAsync(command);
            });

            if (startTimeType == "Daily")
            {
                UpdateDailyAnnoucement(hour, min, sec, interval, loopsCount, command);
            }
            else
            {
                TelepresenceScheduler.IntervalInSeconds(hour, min, sec, interval, loopsCount, action);
            }
        }