Beispiel #1
0
        /// <summary>
        /// 视频移除通道
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OUTToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!(sender is ToolStripMenuItem item))
            {
                return;
            }
            List <VideoPlay> videos = GetSelectRow();

            if (videos == null)
            {
                return;
            }
            Dictionary <int, List <VideoPlay> > VideoDic = new Dictionary <int, List <VideoPlay> >();

            foreach (VideoPlay video in videos)
            {
                if (!VideoDic.Keys.Contains(video.EquipmentID))
                {
                    VideoDic.Add(video.EquipmentID, new List <VideoPlay>());
                }
                VideoDic[video.EquipmentID].Add(video);
            }
            foreach (var it in VideoDic.Keys)
            {
                List <int> ids = VideoDic[it].Select(t => t.Id).ToList();
                if (!EquipmentData.DelteVideosFromEquipment(it, ids))
                {
                    MessageBox.Show($"{string.Join(",", ids)}从设备删除视频失败");
                    Program.log.Error($"{string.Join(",", ids)}从设备删除视频失败");
                }
            }
            MessageBox.Show("从设备删除视频成功");
            Program.log.Info($"{string.Join(",", videos.Select(t=>t.Id).ToList())}从设备删除视频失败");
            bindingSource1.DataSource = null;
            PostVideos();
        }