private void DropToSources(DragDropViewModel data)
        {
            DragDropData dragDropData = CheckFolderOrFile(data);
            if (null == dragDropData)
            {
                return;
            }

            foreach (DragDropData source in this.Sources)
            {
                if (source.Path == dragDropData.Path)
                {
                    // Path is already in Sources of this action
                    // Highlight the duplicated path
                    SelectedIndex = this.Sources.IndexOf(source);
                    return;
                }
            }
            // Backup the Sources before receive new data
            Backup();
            Update(dragDropData);
        }
        private DragDropData CheckFolderOrFile(DragDropViewModel viewModel)
        {
            DragDropData returnData = null;
            if (true == (viewModel is FileViewModel))
            {
                returnData = new DragDropData(viewModel.Data.RelativePath, false);
            }
            else if (true == (viewModel is FolderViewModel))
            {
                returnData = new DragDropData(viewModel.Data.RelativePath, true);
            }

            return returnData;
        }
Ejemplo n.º 3
0
 public void Remove(DragDropViewModel item)
 {
     Items.Remove(item);
 }
        private void DropToDestinations(DragDropViewModel viewModel)
        {
            DragDropData dropData = CheckFolderViewModel(viewModel);
            if (null == dropData)
            {
                return;
            }

            foreach (DragDropData dest in this.Destinations)
            {
                if (dest.Path == dropData.Path)
                {
                    // Path is already in Destinations of this action
                    // Highlight the duplicated path
                    SelectedIndex = this.Destinations.IndexOf(dest);
                    return;
                }
            }
            // Backup the Destinations before receive new data
            Backup();
            Update(dropData);
        }
Ejemplo n.º 5
0
 public void Add(DragDropViewModel item)
 {
     Items.Add(item);
 }