private int _delayTime = 100; //延时时间。 public void DragOver(DropInfo info) { _mouseOn = true; if (!_accepted) { SplitScreenPanel ssp = info.Target as SplitScreenPanel; //延时拖动接收。 if (Environment.TickCount - _startTick < _delayTime) { return; } List <string> ids = info.Data as List <string>; if (ids == null) { info.Effects = DragDropEffects.None; return; } SplitAdorner = CreateAdorner(ssp); //启动动画。 Storyboard sb = CreateStoryboard(1); sb.Begin(SplitAdorner, true); _accepted = true; } }
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 void SetRectTransform(SplitScreenPanel focusPanel, float anchorMinX, float anchorMinY, float anchorMaxX, float anchorMaxY) { focusPanel.anchorMin.x = anchorMinX; focusPanel.anchorMin.y = anchorMinY; focusPanel.anchorMax.x = anchorMaxX; focusPanel.anchorMax.y = anchorMaxY; focusPanel.rectTransform.anchorMin = focusPanel.anchorMin; focusPanel.rectTransform.anchorMax = focusPanel.anchorMax; focusPanel.rectTransform.offsetMin = focusPanel.offsetMin; focusPanel.rectTransform.offsetMax = -focusPanel.offsetMax; }
private void onClearAll() { SplitScreenPanel panel = FindSplitScreen(); if (panel != null) { panel.StopAll(); } }
private void onPlayVideo(string videoId) { SplitScreenPanel panel = FindSplitScreen(); if (panel != null) { panel.PlayVideoOnBlank(videoId); } }
private SplitScreenPanel createSplitPanel() { SplitScreenPanel ssp = new SplitScreenPanel(); SplitScreenModel model = new SplitScreenModel(false) { CanItemClose = false }; ssp.DataContext = model; return(ssp); }
public void SetSplitScreen(SplitScreenPanel panel) { if (panel != null && !defaultSplitPanel.Disposed) { defaultSplitPanel.Dispose(); } borderSplitPanel.Child = panel; if (panel != null) { this.ViewModel.SplitScreenModel = panel.ViewModel; } }
//仅限于交换同级panel的位置。 private bool Exchange(FrameworkElement srcFe, FrameworkElement tarFe) { if (IsBrothers(srcFe, tarFe)) { int rowT = Grid.GetRow(tarFe); int colT = Grid.GetColumn(tarFe); int rowSpanT = Grid.GetRowSpan(tarFe); int colSpanT = Grid.GetColumnSpan(tarFe); int rowS = Grid.GetRow(srcFe); int colS = Grid.GetColumn(srcFe); int rowSpanS = Grid.GetRowSpan(srcFe); int colSpanS = Grid.GetColumnSpan(srcFe); Grid.SetRow(tarFe, rowS); Grid.SetColumn(tarFe, colS); Grid.SetRowSpan(tarFe, rowSpanS); Grid.SetColumnSpan(tarFe, colSpanS); Grid.SetRow(srcFe, rowT); Grid.SetColumn(srcFe, colT); Grid.SetRowSpan(srcFe, rowSpanT); Grid.SetColumnSpan(srcFe, colSpanT); //更改顺序。 Panel parent = tarFe.Parent as Panel; int index1 = parent.Children.IndexOf(srcFe); int index2 = parent.Children.IndexOf(tarFe); SplitScreenPanel ssp = parent.FindVisualParent <SplitScreenPanel>(); if (ssp.ViewModel != null) { //自动保存中数据项交换 var ssd = ssp.ViewModel.SplitScreenData; var first = ssd.Nodes[index1]; ssd.Nodes[index1] = ssd.Nodes[index2]; ssd.Nodes[index2] = first; ssp.ViewModel.SplitScreenData = ssd; } int min = Math.Min(index1, index2); int max = Math.Max(index1, index2); UIElement uiMin = parent.Children[min]; UIElement uiMax = parent.Children[max]; parent.Children.RemoveAt(max); parent.Children.RemoveAt(min); parent.Children.Insert(min, uiMax); parent.Children.Insert(max, uiMin); return(true); } return(false); }
public void Drop(DropInfo info) { _mouseOn = false; _accepted = false; ResetAdorner(); List <string> ids = info.Data as List <string>; if (ids != null) { SplitScreenPanel ssp = info.Target as SplitScreenPanel; if (ssp != null) { foreach (string id in ids) { ssp.PlayVideoOnBlank(id); } } } }
SplitScreenAdorner CreateAdorner(SplitScreenPanel ssp) { SplitScreenAdorner adorner = new SplitScreenAdorner(ssp); return(adorner); }
private void stopMultiVideos(SplitScreenPanel panel) { panel.StopAll(); }