Пример #1
0
        private void OnMsgArrivedEvent(object msg)
        {
            AlertBase alert = (AlertBase)msg;

            this.alert = alert;
            alert.ProcessMessage();

            try
            {
                if (LevelStatusEvent != null)
                {
                    LevelStatusEvent(alert.BatteryLevel, alert.SignalLevel);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("LevelStatusEvent:" + Environment.NewLine + ex.ToString());
            }

            try
            {
                if (MsgArrivedEvent != null)
                {
                    MsgArrivedEvent(alert);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("MsgArrivedEvent:" + Environment.NewLine + ex.ToString());
            }
        }
Пример #2
0
        private void OnBluetoothDisconnectEvent()
        {
            DisconnectAlert alert = new DisconnectAlert();

            this.alert = alert;
            alert.ProcessMessage();

            try
            {
                if (MsgArrivedEvent != null)
                {
                    MsgArrivedEvent(alert);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("MsgArrivedEvent:" + Environment.NewLine + ex.ToString());
            }

            if (BluetoothDisconnectEvent != null)
            {
                BluetoothDisconnectEvent();
            }
        }