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(); } }
static public AlertBase CreateAlert(string data) { AlertBase retVal = null; try { AlertBase msg = new AlertBase(data); DisplayItemType type = msg.ItemType; switch (type) { case DisplayItemType.UNKNOWN: { break; } case DisplayItemType.STATUS: { retVal = new StatusAlert(data); break; } case DisplayItemType.CONNECT: { retVal = new ConnectAlert(data); break; } case DisplayItemType.EMAIL: { retVal = new EmailAlert(data); break; } case DisplayItemType.CALL: { retVal = new CallAlert(data); break; } case DisplayItemType.LOCK: { retVal = new LockAlert(data); break; } case DisplayItemType.SMS: { retVal = new SMSAlert(data); break; } case DisplayItemType.SCREEN: { retVal = new ScreenCaptureAlert(data); break; } case DisplayItemType.CONTACTS: { retVal = new ContactAlert(data); break; } case DisplayItemType.CLIPBOARD: { retVal = new ClipboardAlert(data); break; } case DisplayItemType.DISCONNECT: { retVal = new DisconnectAlert(data); break; } case DisplayItemType.LEVEL: { retVal = new LevelAlert(data); break; } case DisplayItemType.MACRO: { retVal = new MacroAlert(data); break; } case DisplayItemType.PIN_MSG: { retVal = new PINMsgAlert(data); break; } case DisplayItemType.INPUT_MSG: { retVal = new InputAlert(data); break; } case DisplayItemType.READFILE: { retVal = new ReadFileAlert(data); break; } } } catch (Exception ex) { Console.WriteLine("process Message Error:" + Environment.NewLine + ex.ToString()); retVal = null; } return(retVal); }