private void playMultiVideos(SplitScreenPanel panel, int split, IEnumerable <dynamic> videos) { List <SplitScreenNode> nodes = new List <SplitScreenNode>(); foreach (var one in videos) { SplitScreenNode node = new SplitScreenNode() { VideoId = one.VideoId, Row = one.Row, Column = one.Column, RowSpan = one.RowSpan, ColumnSpan = one.ColumnSpan }; nodes.Add(node); } if (nodes.Count > 0) { SplitScreenInfo ssi = new SplitScreenInfo() { Split = split, Nodes = nodes.ToArray() }; panel.ViewModel.SplitScreenData = ssi; } }
private VideoPanelItem findAVideoPanel(SplitScreenNode node) { VideoPanelItem panel = null; if (_garbageItems.Count > 0) { panel = _garbageItems[_garbageItems.Count - 1]; _garbageItems.RemoveAt(_garbageItems.Count - 1); Console.WriteLine("GetPanel from Garbage!"); } else { panel = new VideoPanelItem(ViewModel.CanItemClose); } panel.ViewModel.CanClose = ViewModel.CanItemClose; if (!string.IsNullOrWhiteSpace(node.VideoId)) { panel.PlayVideo(node.VideoId); } //绑定属性 panel.SetBinding(Grid.RowProperty, CreateBinding(node, BindingMode.TwoWay, nameof(node.Row))); panel.SetBinding(Grid.ColumnProperty, CreateBinding(node, BindingMode.TwoWay, nameof(node.Column))); panel.SetBinding(Grid.RowSpanProperty, CreateBinding(node, BindingMode.TwoWay, nameof(node.RowSpan))); panel.SetBinding(Grid.ColumnSpanProperty, CreateBinding(node, BindingMode.TwoWay, nameof(node.ColumnSpan))); panel.ViewModel.SplitScreenNode = node; SetDragDropParam(panel); //监听鼠标点击事件,以隐藏VideoControl的控制面板。 panel.PreviewMouseDown += Panel_PreviewMouseDown; return(panel); }
private void addSnapshot(SplitScreenNode node) { LayoutIcon panel = new LayoutIcon() { DataContext = node }; panel.SetBinding(Grid.RowProperty, CreateBinding(node, BindingMode.TwoWay, nameof(node.Row))); panel.SetBinding(Grid.ColumnProperty, CreateBinding(node, BindingMode.TwoWay, nameof(node.Column))); panel.SetBinding(Grid.RowSpanProperty, CreateBinding(node, BindingMode.TwoWay, nameof(node.RowSpan))); panel.SetBinding(Grid.ColumnSpanProperty, CreateBinding(node, BindingMode.TwoWay, nameof(node.ColumnSpan))); grid.Children.Add(panel); }
private void onDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { SplitScreenNode oldModel = e.OldValue as SplitScreenNode; if (oldModel != null) { //_model.ID = oldModel.VideoId; oldModel.PropertyChanged -= onPropertyChanged; } SplitScreenNode newModel = e.NewValue as SplitScreenNode; if (newModel != null) { newModel.PropertyChanged += onPropertyChanged; _model.ID = newModel.VideoId; } }