示例#1
0
 /// <summary>
 /// 开始记录
 /// </summary>
 /// <param name="deviceId"></param>
 public bool StartRecord(int deviceId, int capture_frame_num = 0, int capture_time = 0, int capture_frame_interval = 0)
 {
     if (IsConnected)
     {
         var date = System.DateTime.Now;
         eagle_device_time time = new eagle_device_time();
         time.wYear       = (UInt16)date.Year;
         time.wMouth      = (UInt16)date.Month;
         time.wDay        = (UInt16)date.Day;
         time.wHour       = (UInt16)date.Hour;
         time.wMinite     = (UInt16)date.Minute;
         time.wSecond     = (UInt16)date.Second;
         time.wMillsecond = (UInt16)date.Millisecond;
         var settime = SDKApi.EagleControl_SetDeviceTimeBase(DeviceId, ref time);
         if (settime > 0)
         {
             _eventAggregator.GetEvent <InfoEventArgs>().Publish("存储设备授时失败!\n");
         }
         bool flag = true;
         var  ret  = SDKApi.EagleControl_StartTask(DeviceId, Settings.Default.TaskName, 0x01, 0);
         if (ret != 0)
         {
             IsRecording = false;
             flag        = false;
             _eventAggregator.GetEvent <InfoEventArgs>().Publish("开启任务失败,请检查任务名称是否有效!\n");
             MessageBox.Show("开启任务失败!");
         }
         var str = SDKApi.EagleControl_StartRecord(DeviceId, 0, 0, 0);
         if (str != 0)
         {
             IsRecording = false;
             flag        = false;
             _eventAggregator.GetEvent <InfoEventArgs>().Publish("开启存储记录失败!\n");
             MessageBox.Show("开启存储记录失败!");
         }
         Thread.Sleep(10);
         Get_Record_List();
         return(flag);
     }
     else
     {
         _eventAggregator.GetEvent <InfoEventArgs>().Publish("存储设备已断开连接!\n");
         return(false);
     }
 }