コード例 #1
0
ファイル: Server.cs プロジェクト: alexkasp/monitor
 private void OnServerEvent(ConnectionServerEventArgs args)
 {
     switch (args.EventType)
     {
         case ConnectionServerEventType.STARTED:
             AddToListBox(lbServerLog, "Started");
             break;
         case ConnectionServerEventType.STOPED:
             AddToListBox(lbServerLog, "Stoped");
             break;
         case ConnectionServerEventType.RESETED:
             break;
         case ConnectionServerEventType.MESSAGE_SENDING:
             AddToTextBox(tbServerOutgoing, "Отправлено: " + _server.OutgoingMessageCount);
             AddToListBox(lbServerLog, "[out] " + ShowMessage((byte[])args.EventData));
             break;
         case ConnectionServerEventType.MESSAGE_RECEIVED:
             AddToTextBox(tbServerIncoming, "Получено: " + _server.IncomingMessageCount);
             AddToListBox(lbServerLog, "[in] " + ShowMessage((byte[])args.EventData));
             AnalyzeMessageFromClient((byte[])args.EventData);
             break;
         case ConnectionServerEventType.CLIENT_CONNECTED:
             AddToListBox(lbServerLog, "Client connected");
             break;
         case ConnectionServerEventType.CLIENT_DISCONNECTED:
             AddToListBox(lbServerLog, "Client disconnected");
             break;
         case ConnectionServerEventType.ERROR_OCCURED:
             AddToListBox(lbServerLog, args.EventData.ToString());
             break;
     }
 }
コード例 #2
0
ファイル: ConnectionServer.cs プロジェクト: alexkasp/monitor
 public void InvokeConnectionServerEvent(ConnectionServerEventArgs args)
 {
     ConnectionServerEventHandler handler = OnConnectionServerEvent;
     if (handler != null) handler(args);
 }