コード例 #1
0
        public void DragStart(DragInfo info)
        {
            if (info.SourceItem == null)
            {
                info.Cancelled = true;
                return;
            }
            RadListBox rlb = info.Source as RadListBox;

            if (rlb != null)
            {
                //设置拖拽窗口视觉效果。
                IEnumerable <RadListBoxItem> items = rlb.FindVisualChildren <RadListBoxItem>();
                foreach (RadListBoxItem item in items)
                {
                    if (item.DataContext.Equals(rlb.SelectedItem))
                    {
                        rlb.SetValue(DragDropVisual.VisualProperty, item);
                        break;
                    }
                }
                SearchNodeHistoryViewModel searchVM = rlb.DataContext as SearchNodeHistoryViewModel;
                if (searchVM == null || searchVM.SelectedVideo == null)
                {//如果没有选中项,或者选中项不是视频节点,取消拖拽。
                    info.Cancelled = true;
                }
            }
        }
コード例 #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            SearchNodeHistoryViewModel model = value as SearchNodeHistoryViewModel;
            List <string> ids = new List <string>();

            FindAllVideo(model.Node, ids);
            return(ids);
        }
コード例 #3
0
        void addNewSourceAboutAllNodeChildren(List <CctvNode> nodes, List <SearchNodeHistoryViewModel> modellist, bool showThumbnails)
        {
            var nodelist = nodes?.Where(e => e.IsCctvNode()).ToList();

            if (nodelist != null && nodelist.Count > 0)
            {
                nodelist?.ForEach(e =>
                {
                    SearchNodeHistoryViewModel model = new SearchNodeHistoryViewModel(AllowDrag);
                    model.UpdateNode(e, showThumbnails);
                    modellist.Add(model);
                });
            }
        }
コード例 #4
0
        void addNewSourceAboutAllVideoChildren(List <CctvNode> nodes, List <SearchNodeHistoryViewModel> modellist)
        {
            var videolist = nodes?.Where(e => e.Type == CctvNode.NodeType.Video).ToList();

            if (videolist != null && videolist.Count > 0)
            {
                var videoModel = new SearchNodeHistoryViewModel(AllowDrag);
                videoModel.UpdateNode(new CctvNode()
                {
                    Name = "视频", Type = CctvNode.NodeType.Unknown, Children = videolist.ToArray()
                }, true);
                modellist.Add(videoModel);
            }
        }
コード例 #5
0
        public void DragEnd(DragInfo info)
        {
            if (info.SourceItem == null)
            {
                return;
            }
            RadListBox rlb = info.Source as RadListBox;

            if (rlb != null)
            {
                SearchNodeHistoryViewModel searchVM = rlb.DataContext as SearchNodeHistoryViewModel;
                if (searchVM != null)
                {
                    searchVM.SelectedVideo = null;
                }
            }
        }