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; } }
/// <summary> /// 双击返回全屏播放 /// </summary> private void BackSingle() { if (singleBorder != null) { foreach (UIElement item in this.gridVideo.Children) { item.Visibility = Visibility.Visible; } if (changeStream) { GridHelpers.SetCameraOnBorder(singleBorder, singleOldItem); changeStream = false; } singleBorder.SetValue(Grid.ColumnProperty, singleCol); singleBorder.SetValue(Grid.RowProperty, singleRow); singleBorder.SetValue(Grid.ColumnSpanProperty, singleColsSpan); singleBorder.SetValue(Grid.RowSpanProperty, singleRowSpan); singleBorder = null; isSinglePlay = false; } }