Beispiel #1
0
        CameraPanelItem singleOldItem = null;  //全屏播放的视频信息
        /// <summary>
        /// 双击全屏播放视频
        /// </summary>
        /// <param name="index">视频索引</param>
        private void SetSingle(int index)
        {
            if (!isSinglePlay)
            {
                var rows = this.gridVideo.RowDefinitions.Count;
                var cols = this.gridVideo.ColumnDefinitions.Count;
                foreach (UIElement item in this.gridVideo.Children)
                {
                    item.Visibility = Visibility.Hidden;
                }

                singleBorder            = GridHelpers.GetBorderByTag(this.gridVideo.Children, index);
                singleBorder.Visibility = Visibility.Visible;
                singleRowSpan           = (int)singleBorder.GetValue(Grid.RowSpanProperty);
                singleRow      = (int)singleBorder.GetValue(Grid.RowProperty);
                singleColsSpan = (int)singleBorder.GetValue(Grid.ColumnSpanProperty);
                singleCol      = (int)singleBorder.GetValue(Grid.ColumnProperty);

                // 视频源全部换为主码流
                singleOldItem = singleBorder.DataContext as CameraPanelItem;
                CameraPanelItem newItem = singleOldItem.Clone() as CameraPanelItem;
                if (newItem.PlayType == PlayContentType.One && newItem.Camera.StreamType == 1)
                {
                    singleOldItem.GetPlayView().Stop();
                    newItem.Camera.StreamType = 0;
                    changeStream = true;
                }
                if (newItem.PlayType == PlayContentType.Group)
                {
                    for (int i = 0; i < newItem.CameraGroup.Items.Count; i++)
                    {
                        if (newItem.CameraGroup.Items[i].StreamType == 1)
                        {
                            singleOldItem.GetPlayView().Stop();
                            newItem.CameraGroup.Items[i].StreamType = 0;
                            changeStream = true;
                        }
                    }
                }
                if (changeStream)
                {
                    GridHelpers.SetCameraOnBorder(singleBorder, newItem);
                }

                singleBorder.SetValue(Grid.RowProperty, 0);
                singleBorder.SetValue(Grid.ColumnProperty, 0);
                singleBorder.SetValue(Grid.ColumnSpanProperty, cols);
                singleBorder.SetValue(Grid.RowSpanProperty, rows);

                isSinglePlay = true;
            }
        }
Beispiel #2
0
        bool changeStream = false;  // 是否需要更改码流
        /// <summary>
        /// 双击全屏播放视频
        /// </summary>
        /// <param name="index">视频索引</param>
        private void SetSingle(int index)
        {
            if (!isSinglePlay)
            {
                var rows = this.gridVideo.RowDefinitions.Count;
                var cols = this.gridVideo.ColumnDefinitions.Count;
                foreach (UIElement item in this.gridVideo.Children)
                {
                    item.Visibility = Visibility.Hidden;
                }

                newBorder            = GridHelpers.CreateBorder();
                newBorder.Visibility = Visibility.Visible;
                Border singleBorder = GridHelpers.GetBorderByTag(this.gridVideo.Children, index);

                // 视频源全部换为主码流
                CameraPanelItem singleOldItem = singleBorder.DataContext as CameraPanelItem;
                CameraPanelItem newItem       = singleOldItem.Clone() as CameraPanelItem;
                if (newItem.PlayType == PlayContentType.One && newItem.Camera.StreamType == 1)
                {
                    newItem.RtspStrs[0]       = newItem.RtspStrs[0].Replace("/sub/", "/main/");
                    newItem.Camera.StreamType = 0;
                    changeStream = true;
                }
                if (newItem.PlayType == PlayContentType.Group)
                {
                    for (int i = 0; i < newItem.CameraGroup.Items.Count; i++)
                    {
                        if (newItem.CameraGroup.Items[i].StreamType == 1)
                        {
                            newItem.RtspStrs[i] = newItem.RtspStrs[i].Replace("/sub/", "/main/");
                            newItem.CameraGroup.Items[i].StreamType = 0;
                            changeStream = true;
                        }
                    }
                }
                newBorder.SetValue(Grid.RowProperty, 0);
                newBorder.SetValue(Grid.ColumnProperty, 0);
                newBorder.SetValue(Grid.ColumnSpanProperty, cols);
                newBorder.SetValue(Grid.RowSpanProperty, rows);
                this.gridVideo.Children.Add(newBorder);
                if (changeStream)
                {
                    GridHelpers.SetBorderChildByVLC(newBorder, newItem);
                }

                isSinglePlay = true;
            }
        }