Пример #1
0
 private void OnClientEvent(ConnectionClientEventArgs args)
 {
     switch (args.EventType)
     {
         case ConnectionClientEventType.CONNECTED:
             AddToListBox(lbClientLog, "connected");
             foreach (var machine in VmManager.GetVms())
             {
                 GetVmStatus(machine.Id);
             }
             break;
         case ConnectionClientEventType.CONNECTING:
             AddToListBox(lbClientLog, "Connecting");
             break;
         case ConnectionClientEventType.DISCONNECTED:
             AddToListBox(lbClientLog, "Disconnected");
             break;
         case ConnectionClientEventType.MESSAGE_SENDING:
             AddToTextBox(tbClientOutgoing, "Отправлено: " + _client.OutgoingMessageCount);
             AddToListBox(lbClientLog, "[out] " + ShowMessage((byte[])args.EventData));
             break;
         case ConnectionClientEventType.MESSAGE_RECEIVED:
             AddToTextBox(tbClientIncoming, "Получено: " + _client.IncomingMessageCount);
             AddToListBox(lbClientLog, "[in] " + ShowMessage((byte[])args.EventData));
             break;
         case ConnectionClientEventType.RESETED:
             AddToListBox(lbClientLog, "Reseted");
             break;
         case ConnectionClientEventType.RESETING:
             break;
         case ConnectionClientEventType.ERROR_OCCURED:
             AddToListBox(lbClientLog, args.EventData.ToString());
             break;
     }
 }
Пример #2
0
 /*private void OnWorkerEvent(WorkerEventArgs args)
 {
     switch (args.EventType)
     {
         case WorkerEventType.REMOTE_CONNECTION_ESTABLISHED:
             break;
         case WorkerEventType.REMOTE_CONNECTION_LOST:
             break;
     }
 }*/
 private void OnConnectionClientEvent(ConnectionClientEventArgs args)
 {
     switch (args.EventType)
         {
             case ConnectionClientEventType.CONNECTING:
                 MLogger.LogTo(Level.TRACE, false, (String)args.EventData);
                 break;
             case ConnectionClientEventType.CONNECTED:
                 MLogger.LogTo(Level.TRACE, false, "Remote server connection: connected");
                  _communicationStatus = true;
                 break;
             case ConnectionClientEventType.DISCONNECTED:
                 MLogger.LogTo(Level.TRACE, false, "Remote server connection: disconnected");
                 _communicationStatus = false;
                 break;
             case ConnectionClientEventType.MESSAGE_RECEIVED:
                 MLogger.LogTo(Level.TRACE, false, "Srv ---> Web: " + DataUtils.ByteArrayToHexString((byte[])args.EventData));
                 PacketAnalyzer.AnalyzeReceived(Packet.ToPacket((byte[])args.EventData), _client);
                 break;
             case ConnectionClientEventType.MESSAGE_SENDING:
                 MLogger.LogTo(Level.TRACE, false, "Web ---> Srv: " + DataUtils.ByteArrayToHexString((byte[])args.EventData));
                 break;
         }
 }
Пример #3
0
 public void InvokeConnectionClientEvent(ConnectionClientEventArgs args)
 {
     ConnectionClientEventHandler handler = OnConnectionClientEvent;
     if (handler != null) handler(args);
 }
Пример #4
0
 private void OnConnectionClientEvent(ConnectionClientEventArgs args)
 {
     InvokeOnConnectionClientExEvent(args);
 }