Esempio n. 1
0
        private void client_CommandReceived(object sender , CommandEventArgs e)
        {
            switch (e.Command.CommandType)
            {

                /// bool Start();

                case CommandType.VS_START:
                    Console.WriteLine("COMMAND : VS_START...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //Start(e.Command.MetaData);
                    break;

                /// bool StartAll();

                case CommandType.VS_START_ALL:
                    Console.WriteLine("COMMAND : VS_START_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StartAll(e.Command.MetaData);
                    break;

                /// bool Stop();

                case CommandType.VS_STOP:
                    Console.WriteLine("COMMAND : VS_STOP...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //Stop(e.Command.MetaData);
                    break;

                /// bool StopAll();

                case CommandType.VS_STOP_ALL:
                    Console.WriteLine("COMMAND : VS_STOP_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //Stop(e.Command.MetaData);
                    break;

                /// bool StartConnect(String camName)

                case CommandType.VS_START_CONNECT:
                    Console.WriteLine("COMMAND : VS_START_CONNECT...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StartConnect(e.Command.MetaData);
                    break;

                /// bool StartConnectAll()

                case CommandType.VS_START_CONNECT_ALL:
                    Console.WriteLine("COMMAND : VS_START_CONNECT_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StartConnectAll(e.Command.MetaData);
                    break;

                /// bool StopConnect(String camName);

                case CommandType.VS_STOP_CONNECT:
                    Console.WriteLine("COMMAND : VS_STOP_CONNECT...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StopConnect(e.Command.MetaData);
                    break;

                /// bool StopConnectAll();

                case CommandType.VS_STOP_CONNECT_ALL:
                    Console.WriteLine("COMMAND : VS_STOP_CONNECT_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StopConnectAll(e.Command.MetaData);
                    break;


                /// bool StartAnalyse(String camName);

                case CommandType.VS_START_ANALYSE:
                    Console.WriteLine("COMMAND : VS_START_ANALYSE...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StartAnalyse(e.Command.MetaData);
                    break;

                /// bool StartAnalyseAll();

                case CommandType.VS_START_ANALYSE_ALL:
                    Console.WriteLine("COMMAND : VS_START_ANALYSE_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StartAnalyseAll(e.Command.MetaData);
                    break;

                /// bool StopAnalyse(String camName);

                case CommandType.VS_STOP_ANALYSE:
                    Console.WriteLine("COMMAND : VS_STOP_ANALYSE...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StopAnalyse(e.Command.MetaData);
                    break;

                ///  bool StopAnalyseAll();

                case CommandType.VS_STOP_ANALYSE_ALL:
                    Console.WriteLine("COMMAND : VS_STOP_ANALYSE_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StopAnalyseAll(e.Command.MetaData);
                    break;


                /// bool StartEventAlert(String camName);

                case CommandType.VS_START_EVENT_ALERT:
                    Console.WriteLine("COMMAND : VS_START_EVENT_ALERT...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StartEventAlert(e.Command.MetaData);
                    break;

                /// bool StartEventAlertAll();

                case CommandType.VS_START_EVENT_ALERT_ALL:
                    Console.WriteLine("COMMAND : VS_START_EVENT_ALERT_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StartEventAlertAll(e.Command.MetaData);
                    break;

                /// bool StopEventAlert(String camName);

                case CommandType.VS_STOP_EVENT_ALERT:
                    Console.WriteLine("COMMAND : VS_STOP_EVENT_ALERT...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StopEventAlert(e.Command.MetaData);
                    break;

                /// bool StopEventAlertAll();

                case CommandType.VS_STOP_EVENT_ALERT_ALL:
                    Console.WriteLine("COMMAND : VS_STOP_EVENT_ALERT_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StopEventAlertAll(e.Command.MetaData);
                    break;


                /// bool StartRecord(String camName);

                case CommandType.VS_START_RECORD:
                    Console.WriteLine("COMMAND : VS_START_RECORD...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StartRecord(e.Command.MetaData);
                    break;

                /// bool StartRecordAll();

                case CommandType.VS_START_RECORD_ALL:
                    Console.WriteLine("COMMAND : VS_START_RECORD_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StartRecordAll(e.Command.MetaData);
                    break;

                /// bool StopRecord(String camName);

                case CommandType.VS_STOP_RECORD:
                    Console.WriteLine("COMMAND : VS_STOP_RECORD...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StopRecord(e.Command.MetaData);
                    break;

                /// bool StopRecordAll();

                case CommandType.VS_STOP_RECORD_ALL:
                    Console.WriteLine("COMMAND : VS_STOP_RECORD_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StopRecordAll(e.Command.MetaData);
                    break;


                /// bool StartDataAlert(String camName);

                case CommandType.VS_START_DATA_ALERT:
                    Console.WriteLine("COMMAND : VS_START_DATA_ALERT...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StartDataAlert(e.Command.MetaData);
                    break;

                /// bool StartDataAlertAll();

                case CommandType.VS_START_DATA_ALERT_ALL:
                    Console.WriteLine("COMMAND : VS_START_DATA_ALERT_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StartDataAlertAll(e.Command.MetaData);
                    break;

                /// bool StopDataAlert(String camName);

                case CommandType.VS_STOP_DATA_ALERT:
                    Console.WriteLine("COMMAND : VS_STOP_DATA_ALERT...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StopDataAlert(e.Command.MetaData);
                    break;

                /// bool StopDataAlertAll();

                case CommandType.VS_STOP_DATA_ALERT_ALL:
                    Console.WriteLine("COMMAND : VS_STOP_DATA_ALERT_ALL...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); listBox1.Items.Add("=>" + e.Command.MetaData);
                    //StopDataAlertAll(e.Command.MetaData);
                    break;


                /// String[] ListCameras();

                case CommandType.VS_LIST_CAMERAS:
                    Console.WriteLine("COMMAND : VS_LIST_CAMERAS...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); String[] strList = e.Command.MetaData.Split(';');  foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListCameras(e.Command.MetaData);
                    break;

                /// String[] ListCamerasConnect();

                case CommandType.VS_LIST_CAMERAS_CONNECT_STATUS:
                    Console.WriteLine("COMMAND : VS_LIST_CAMERAS_CONNECT_STATUS...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); strList = null;  strList = e.Command.MetaData.Split(';'); foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListCamerasConnect(e.Command.MetaData);
                    break;

                /// String[] ListCamerasAnalyse();

                case CommandType.VS_LIST_CAMERAS_ANALYSE_STATUS:
                    Console.WriteLine("COMMAND : VS_LIST_CAMERAS_ANALYSE_STATUS...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); strList = null; strList = e.Command.MetaData.Split(';'); foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListCamerasAnalyse(e.Command.MetaData);
                    break;

                /// String[] ListCamerasEventAlert();

                case CommandType.VS_LIST_CAMERAS_EVENT_ALERT_STATUS:
                    Console.WriteLine("COMMAND : VS_LIST_CAMERAS_EVENT_ALERT_STATUS...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); strList = null; strList = e.Command.MetaData.Split(';'); foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListCamerasEventAlert(e.Command.MetaData);
                    break;

                /// String[] ListCamerasRecord();

                case CommandType.VS_LIST_CAMERAS_RECORD_STATUS:
                    Console.WriteLine("COMMAND : VS_LIST_CAMERAS_RECORD_STATUS...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); strList = null; strList = e.Command.MetaData.Split(';'); foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListCamerasRecord(e.Command.MetaData);
                    break;

                /// String[] ListCamerasDataAlert();

                case CommandType.VS_LIST_CAMERAS_DATA_ALERT_STATUS:
                    Console.WriteLine("COMMAND : VS_LIST_CAMERAS_DATA_ALERT_STATUS...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); strList = null; strList = e.Command.MetaData.Split(';'); foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListCamerasDataAlert(e.Command.MetaData);
                    break;


                /// String ListCameraConnect(String camName);

                case CommandType.VS_LIST_CAMERA_CONNECT_STATUS:
                    Console.WriteLine("COMMAND : VS_LIST_CAMERA_CONNECT_STATUS...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); strList = null; strList = e.Command.MetaData.Split(';'); foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListCameraConnect(e.Command.MetaData);
                    break;

                /// String ListCameraAnalyse(String camName);

                case CommandType.VS_LIST_CAMERA_ANALYSE_STATUS:
                    Console.WriteLine("COMMAND : VS_LIST_CAMERA_ANALYSE_STATUS...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); strList = null; strList = e.Command.MetaData.Split(';'); foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListCameraAnalyse(e.Command.MetaData);
                    break;

                /// String ListCameraEventAlert(String camName);

                case CommandType.VS_LIST_CAMERA_EVENT_ALERT_STATUS:
                    Console.WriteLine("COMMAND : VS_LIST_CAMERA_EVENT_ALERT_STATUS...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); strList = null; strList = e.Command.MetaData.Split(';'); foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListCameraEventAlert(e.Command.MetaData);
                    break;

                /// String ListCameraRecord(String camName);

                case CommandType.VS_LIST_CAMERA_RECORD_STATUS:
                    Console.WriteLine("COMMAND : VS_LIST_CAMERA_RECORD_STATUS...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); strList = null; strList = e.Command.MetaData.Split(';'); foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListCameraRecord(e.Command.MetaData);
                    break;

                /// String ListCameraDataAlert(String camName);

                case CommandType.VS_LIST_CAMERA_DATA_ALERT_STATUS:
                    Console.WriteLine("COMMAND : VS_LIST_CAMERA_DATA_ALERT_STATUS...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); strList = null; strList = e.Command.MetaData.Split(';'); foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListCameraDataAlert(e.Command.MetaData);
                    break;


                /// vsStatus infomation

                case CommandType.VS_INFO:
                    Console.WriteLine("COMMAND : VS_INFO...");
                    Console.WriteLine("METADA : {0}", e.Command.MetaData); strList = null; strList = e.Command.MetaData.Split(';'); foreach (String str in strList) { if(str.Length>0) listBox1.Items.Add("=>" + str); }
                    //ListInfo(e.Command.MetaData);
                    break;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Occurs when a command received from a remote client.
 /// </summary>
 /// <param name="e">The received command.</param>
 protected virtual void OnCommandReceived(CommandEventArgs e)
 {
     if ( CommandReceived != null )
     {
         Control target = CommandReceived.Target as Control;
         if ( target != null && target.InvokeRequired )
             target.Invoke(CommandReceived , new object [] { this , e });
         else
             CommandReceived(this , e);
     }
 }