Exemplo n.º 1
0
        private void OnNotificationFinishedReady(FinishPortEvent e)
        {
            EventHandler <FinishPortEvent> handler = NotificationFinishedReady;

            if (handler != null)
            {
                NotificationFinishedReady(this, e);
            }
        }
Exemplo n.º 2
0
        private void OnTelephoneFinishedReady(FinishPortEvent e)
        {
            EventHandler <FinishPortEvent> handler = TelephoneFinishedReady;

            if (handler != null)
            {
                TelephoneFinishedReady(this, e);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// This event handler deals with the results of the background operation.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            var guiEvent = new FinishPortEvent();

            if (e.Cancelled)
            {
                //resultLabel.Text = "Canceled!";
            }
            else if (e.Error != null)
            {
                Logger.Write(ResourceManagerProvider.GetLocalizedString("MSG_ERROR_MODEM_TITLE", Application.CurrentCulture) + " " + e.Error.StackTrace);
                guiEvent.Exception = e.Error;
            }

            try
            {
                ClosePort();
                Logger.Write(ResourceManagerProvider.GetLocalizedString("MSG_MODEM_WORK_COMPLETED", Application.CurrentCulture));
            }
            catch (Exception ex)
            {
                Logger.Write(ResourceManagerProvider.GetLocalizedString("MSG_ERROR_MODEM_TITLE", Application.CurrentCulture) + " " + ex.StackTrace);
                guiEvent.Exception = ex;
            }

            switch (Operation)
            {
            case PortReaderOperation.Call:
                OnTelephoneFinishedReady(guiEvent);
                break;

            case PortReaderOperation.Notification:
                OnNotificationFinishedReady(guiEvent);
                break;
            }
        }