예제 #1
0
        void Anounce_Message(string msg)
        {
            MainEvent.ConfirmData(new BOL.Task.objTask()
            {
                id = 0, terminal_id = null, type = BOL.Task.objTask.MessageType.Mute
            });
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork += (s, arg) =>
            {
                try
                {
                    NotificationSound.PlaySync();
                    Voice.Speak(msg);
                }
                catch (Exception ex)
                {
                    EventLog.WriteEntry("Display", ex.Message, EventLogEntryType.Error);
                }
            };
            bw.RunWorkerCompleted += (s, arg) =>
            {
                if (Voice.State != System.Speech.Synthesis.SynthesizerState.Speaking)
                {
                    MainEvent.ConfirmData(new BOL.Task.objTask()
                    {
                        id = 0, terminal_id = null, type = BOL.Task.objTask.MessageType.Unmute
                    });
                }
            };
            bw.RunWorkerAsync();
        }
예제 #2
0
        void Start_Query()
        {
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork += (s, arg) =>
            {
                arg.Result = DAL.Task.Task_Repository.GetDisplayCurrentTask();
            };

            bw.RunWorkerCompleted += (s, arg) =>
            {
                if (arg.Error == null)
                {
                    if (arg.Result != null)
                    {
                        MainEvent.ConfirmData((BOL.Task.objTask)arg.Result);
                    }
                }
                else
                {
                    Prompt_No_Connection();
                }
                Start_Query();
            };
            bw.RunWorkerAsync();
        }