Example #1
0
            public void Drop(IDropInfo dropInfo)
            {
                if (dropInfo.Data is ServerViewModel serverViewModel)
                {
                    networkViewModel.AddServer(serverViewModel, dropInfo.InsertIndex);
                }

                if (dropInfo.Data is NetworkServer)
                {
                    dropHandler.Drop(dropInfo);
                }
            }
Example #2
0
        void IDropTarget.Drop(DropInfo drop_info)
        {
            log.Trace("Drop");

            default_drop_handler.Drop(drop_info);

            if (drop_info.Data is Post)
            {
                var posts_view = CollectionViewSource.GetDefaultView(Posts);
                posts_view.MoveCurrentTo(drop_info.Data);
            }
        }
        void IDropTarget.Drop(IDropInfo dropInfo)
        {
            if (!(DataContext is LibraryVM libraryVM))
            {
                Log.Error("DataContext of SongsGrid is not LibraryVM in Songs_OnDrop, but is {type}", DataContext?.GetType());
                return;
            }

            if (!(Songs.ItemsSource is ListCollectionView view))
            {
                Log.Error("ItemSource of the SongsGrid is not a ListCollectionView, but is a {itemsSource}", Songs.ItemsSource?.GetType());
                return;
            }

            DefaultDropHandler handler = new DefaultDropHandler();

            handler.Drop(dropInfo);
            libraryVM.ResetSongsInCurrentPlaylist(view.SourceCollection.Cast <SongItem>().Select(x => x.Id));
        }
Example #4
0
        private static void OnPreviewDrop(object sender, DragEventArgs e)
        {
            var dropInfo    = new DropInfo(sender, e, _dragInfo, Format.Name);
            var dropHandler = GetDropHandler((UIElement)sender);

            DragAdorner       = null;
            DropTargetAdorner = null;

            if (dropHandler != null)
            {
                dropHandler.Drop(dropInfo);
            }
            else
            {
                DefaultDropHandler.Drop(dropInfo);
            }

            e.Handled = true;
        }
Example #5
0
        void IDropTarget.Drop(DropInfo drop_info)
        {
            if (drop_info.TargetItem == null)
            {
                log.Trace("Dropping on " + drop_info.TargetCollection.ToString());
            }
            else
            {
                if (drop_info.TargetItem is Account)
                {
                    log.Trace("Dropping on " + (drop_info.TargetItem as Account).Name);
                }
                else
                {
                    log.Trace("Dropping on " + (drop_info.TargetItem as Post).Text);
                }
            }

            default_drop_handler.Drop(drop_info);

            if (drop_info.Data is Account)
            {
                var accounts_view = CollectionViewSource.GetDefaultView(Accounts);
                accounts_view.MoveCurrentTo(drop_info.Data);
            }
            else if (drop_info.Data is Post)
            {
                var     accounts_view   = CollectionViewSource.GetDefaultView(Accounts);
                Account current_account = accounts_view.CurrentItem as Account;
                if (current_account == null)
                {
                    return;
                }
                // Get selected post
                var posts_view = CollectionViewSource.GetDefaultView(current_account.Posts);
                posts_view.MoveCurrentTo(drop_info.Data);
            }
        }