Beispiel #1
0
 private void btPause_Click(object sender, EventArgs e)
 {
     if (this.btPause.Text == Messages.Pause)
     {
         try
         {
             BcVideoServer     bcVideoServer     = BcVideoServer.LoadById(this.MainDevice.Vsid);
             VideoServerClient videoServerClient = new VideoServerClient();
             videoServerClient.Endpoint.Address = new EndpointAddress("net.tcp://" + (object)bcVideoServer.Ip + ":" + (string)(object)bcVideoServer.Port + "/VideoStreamServer/VideoServer");
             videoServerClient.Open();
             videoServerClient.Pause(this.MainDevice.Id);
             this.btPause.Text = Messages.Continue;
             videoServerClient.Abort();
         }
         catch (Exception ex)
         {
         }
     }
     else
     {
         try
         {
             BcVideoServer     bcVideoServer     = BcVideoServer.LoadById(this.MainDevice.Vsid);
             VideoServerClient videoServerClient = new VideoServerClient();
             videoServerClient.Endpoint.Address = new EndpointAddress("net.tcp://" + (object)bcVideoServer.Ip + ":" + (string)(object)bcVideoServer.Port + "/VideoStreamServer/VideoServer");
             videoServerClient.Open();
             this.btPause.Text = Messages.Pause;
             videoServerClient.Run(this.MainDevice.Id);
             videoServerClient.Abort();
         }
         catch (Exception ex)
         {
         }
     }
 }
Beispiel #2
0
 private void btPlay_Click(object sender, EventArgs e)
 {
     try
     {
         BcVideoServer     bcVideoServer     = BcVideoServer.LoadById(this.MainDevice.Vsid);
         VideoServerClient videoServerClient = new VideoServerClient();
         videoServerClient.Endpoint.Address = new EndpointAddress("net.tcp://" + (object)bcVideoServer.Ip + ":" + (string)(object)bcVideoServer.Port + "/VideoStreamServer/VideoServer");
         videoServerClient.Open();
         this.trackBarControl1.Visible = true;
         this.trackBarControl1.Value   = 0;
         this.btPause.Visible          = true;
         this.btPlay.Visible           = true;
         this.btStop.Visible           = true;
         videoServerClient.PlayStart(this.MainDevice.Id);
         try
         {
             Thread.Sleep(2000);
             this.trackBarControl1.Properties.Maximum = (int)videoServerClient.GetDuration(this.MainDevice.Id);
         }
         catch (Exception ex)
         {
         }
         this.btPause.Text = "Пауза";
         videoServerClient.Abort();
     }
     catch (Exception ex)
     {
     }
 }
        private static VideoServerClient CreateAndOpen(string ip, int port)
        {
            VideoServerClient videoServerClient = new VideoServerClient();

            videoServerClient.Endpoint.Address = new EndpointAddress("net.tcp://" + (object)ip + ":" + (string)(object)port + "/VideoStreamServer/VideoServer");
            videoServerClient.Open();
            return(videoServerClient);
        }
Beispiel #4
0
 public void WorkerThread()
 {
     while (!FrmDevices.ClosFlag)
     {
         if (this.CloseForm)
         {
             break;
         }
         try
         {
             BcVideoServer bcVideoServer = BcVideoServer.LoadById(this.MainDevice.Vsid);
             if (bcVideoServer.Id != Guid.Empty)
             {
                 int num = 0;
                 VideoServerClient videoServerClient = new VideoServerClient();
                 videoServerClient.Endpoint.Address = new EndpointAddress("net.tcp://" + (object)bcVideoServer.Ip + ":" + (string)(object)bcVideoServer.Port + "/VideoStreamServer/VideoServer");
                 videoServerClient.Open();
                 while (!FrmDevices.ClosFlag)
                 {
                     ++num;
                     if (!this.CloseForm)
                     {
                         byte[] imageFromDevice = videoServerClient.GetImageFromDevice(this.MainDevice.Id);
                         if (imageFromDevice != null && imageFromDevice.Length > 0)
                         {
                             using (MemoryStream memoryStream = new MemoryStream(imageFromDevice))
                                 this.Invoke((Delegate) new FrmVideo.NewImageFunc(this.NewImage), (object)new Bitmap((Stream)memoryStream));
                         }
                         Thread.Sleep(20);
                         if (num >= 20 && this.MainDevice.Type == "File")
                         {
                             try
                             {
                                 this._nextPos = true;
                                 this.Invoke((Delegate) new FrmVideo.SetNewPosFunc(this.SetNewPos), (object)(int)videoServerClient.GetCurrentPos(this.MainDevice.Id));
                                 this._nextPos = false;
                                 num           = 0;
                             }
                             catch (Exception ex)
                             {
                             }
                         }
                     }
                     else
                     {
                         break;
                     }
                 }
             }
         }
         catch (Exception ex)
         {
         }
         Thread.Sleep(1000);
     }
 }
Beispiel #5
0
 private void btStop_Click(object sender, EventArgs e)
 {
     try
     {
         BcVideoServer     bcVideoServer     = BcVideoServer.LoadById(this.MainDevice.Vsid);
         VideoServerClient videoServerClient = new VideoServerClient();
         videoServerClient.Endpoint.Address = new EndpointAddress("net.tcp://" + (object)bcVideoServer.Ip + ":" + (string)(object)bcVideoServer.Port + "/VideoStreamServer/VideoServer");
         videoServerClient.Open();
         this.trackBarControl1.Value = 0;
         videoServerClient.Stop(this.MainDevice.Id);
         videoServerClient.Abort();
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #6
0
 private void trackBarControl1_EditValueChanged(object sender, EventArgs e)
 {
     if (!this._nextPos)
     {
         try
         {
             BcVideoServer     bcVideoServer     = BcVideoServer.LoadById(this.MainDevice.Vsid);
             VideoServerClient videoServerClient = new VideoServerClient();
             videoServerClient.Endpoint.Address = new EndpointAddress("net.tcp://" + (object)bcVideoServer.Ip + ":" + (string)(object)bcVideoServer.Port + "/VideoStreamServer/VideoServer");
             videoServerClient.Open();
             videoServerClient.SetPos(this.MainDevice.Id, (double)this.trackBarControl1.Value);
             videoServerClient.Abort();
         }
         catch (Exception ex)
         {
         }
     }
     this.lbPeriod.Text = this.GetTime((double)this.trackBarControl1.Value) + "//" + this.GetTime((double)this.trackBarControl1.Properties.Maximum);
 }