public void scheduler_DragOver(object sender, DragAndDropEventArgs e)
 {
     if (!ReferenceEquals(e.Target, e.Source))
     {
         e.Accept = true;
     }
 }
        void Instance_DragAndDropEnd(object sender, DragAndDropEventArgs args)
        {
            ObservableCollection <string> from =
                ((ItemsControl)args.DragSource).ItemsSource as ObservableCollection <string>;
            ObservableCollection <string> to =
                ((ItemsControl)args.DropTarget).ItemsSource as ObservableCollection <string>;

            from.Remove((string)args.DragData);
            to.Add((string)args.DragData);
        }
Пример #3
0
        void Instance_DragAndDropEnd(object sender, DragAndDropEventArgs args)
        {
            //var dragAndDropHost = ApexBroker.GetShell().DragAndDropHost;
            Point point = Mouse.GetPosition(dragAndDropHost);

            point.Offset(-args.InitialElementOffset.X, -args.InitialElementOffset.Y);

            //  Set the position of the element.
            Canvas.SetLeft(args.DragElement, point.X);
            Canvas.SetTop(args.DragElement, point.Y);

            args.DragElement.Opacity = 1;
        }
Пример #4
0
        public override void DraggingEnded(NSDraggingInfo sender)
        {
            if (DragAndDropHandler != null)
            {
                var filePathUrl = GetFilePathUrl(sender);
                if (IsCSharpFilePathUrl(filePathUrl))
                {
                    var args = new DragAndDropEventArgs {
                        Text = System.IO.File.ReadAllText(filePathUrl.Path)
                    };

                    DragAndDropHandler(this, args);
                }
            }
        }
Пример #5
0
        void Instance_DragAndDropEnd(object sender, DragAndDropEventArgs args)
        {
            //var dragAndDropHost = ApexBroker.GetShell().DragAndDropHost;

            /*
             * TODO: mouse pos must come from apex shell.
             *
             * Point point = Mouse.GetPosition(dragAndDropHost);
             * point.Offset(-args.InitialElementOffset.X, -args.InitialElementOffset.Y);
             *
             * //  Set the position of the element.
             * Canvas.SetLeft(args.DragElement, point.X);
             * Canvas.SetTop(args.DragElement, point.Y);
             *
             * args.DragElement.Opacity = 1;*/
        }
        public void scheduler_Drop(object sender, DragAndDropEventArgs e)
        {
            ISchedulerHitInfo hitInfo = SchedulerHitInfo.CreateSchedulerHitInfo(schedulerControl1, e.Location);
            VisualSelectableIntervalViewInfo vsivi = hitInfo.ViewInfo as VisualSelectableIntervalViewInfo;

            if (vsivi != null)
            {
                IList dragData = (IList)e.DragData;

                for (int i = 0; i < dragData.Count; i++)
                {
                    ((IList)gridControl1.ItemsSource).Remove(dragData[i]);
                    Appointment apt = ScheduleTaskToAppointment(dragData[i] as ScheduleTask);
                    apt.Start = vsivi.Interval.Start;
                    schedulerControl1.Storage.AppointmentStorage.Add(apt);
                }
            }
        }
Пример #7
0
        private void Instance_DragAndDropStart(object sender, DragAndDropEventArgs args)
        {
            //  The data should be a playing card.

            if (!(args.DragData is PlayingCardViewModel card) || card.IsPlayable == false)
            {
                args.Allow = false;

                return;
            }

            args.Allow = true;

            //  If the card is draggable, we're going to want to drag the whole stack.
            var cards = _viewModel.GetCardCollection(card);

            _draggingCards = new List <PlayingCardViewModel>();

            var start = cards.IndexOf(card);

            for (var i = start; i < cards.Count; i++)
            {
                _draggingCards.Add(cards[i]);
            }

            //  Clear the drag stack.
            DragStack.ItemsSource = _draggingCards;

            DragStack.UpdateLayout();

            args.DragAdorner = new VisualAdorner(DragStack);

            var sourceStack  = (ItemsControl)args.DragSource;
            var playingCards = (ObservableCollection <PlayingCardViewModel>)sourceStack.ItemsSource;

            //  Hide each dragging card.
            foreach (var dragCard in _draggingCards)
            {
                playingCards.Remove(dragCard);
            }
        }
Пример #8
0
        void Instance_DragAndDropEnd(object sender, DragAndDropEventArgs args)
        {
            //  We've put cards temporarily in the drag stack, put them in the
            //  source stack again.
            ItemsControl sourceStack = args.DragSource as ItemsControl;

            foreach (var dragCard in draggingCards)
            {
                ((ObservableCollection <PlayingCard>)((ItemsControl)args.DragSource).ItemsSource).Add(dragCard);
            }

            //  If we have a drop target, move the card.
            if (args.DropTarget != null)
            {
                //  Move the card.
                ViewModel.MoveCard(
                    (ObservableCollection <PlayingCard>)((ItemsControl)args.DragSource).ItemsSource,
                    (ObservableCollection <PlayingCard>)((ItemsControl)args.DropTarget).ItemsSource,
                    (PlayingCard)args.DragData, false);
            }
        }
        void Instance_DragAndDropEnd(object sender, DragAndDropEventArgs args)
        {
            //  We've put cards temporarily in the drag stack, put them in the
            //  source stack again.
            ItemsControl sourceStack = args.DragSource as ItemsControl;

            foreach (var dragCard in draggingCards)
            {
                ((ObservableCollection <PlayingCard>)((ItemsControl)args.DragSource).ItemsSource).Add(dragCard);
            }

            //  If we have a drop target, move the card.
            if (args.DropTarget != null)
            {
                //  Move the card.
                ViewModel.MoveCard(
                    (ObservableCollection <PlayingCard>)((ItemsControl)args.DragSource).ItemsSource,
                    (ObservableCollection <PlayingCard>)((ItemsControl)args.DropTarget).ItemsSource,
                    (PlayingCard)args.DragData, false);
                //Console.Write("IZMENA\n");
                State s = new State();
                s.tabla.Add(ViewModel.Tableau1.ToList());
                s.tabla.Add(ViewModel.Tableau2.ToList());
                s.tabla.Add(ViewModel.Tableau3.ToList());
                s.tabla.Add(ViewModel.Tableau4.ToList());
                s.tabla.Add(ViewModel.Tableau5.ToList());
                s.tabla.Add(ViewModel.Tableau6.ToList());
                s.tabla.Add(ViewModel.Tableau7.ToList());
                s.tabla.Add(ViewModel.Tableau8.ToList());
                s.tabla.Add(ViewModel.Tableau9.ToList());
                s.tabla.Add(ViewModel.Tableau10.ToList());

                //  AStarSearch aStar = new AStarSearch();
                // aStar.search(s);
                DepthFirstSearch dFirst = new DepthFirstSearch();
                dFirst.search(s);
            }
        }
Пример #10
0
        private void Instance_DragAndDropEnd(object sender, DragAndDropEventArgs args)
        {
            var itemsControl = (ItemsControl)args.DragSource;
            var playingCards = (ObservableCollection <PlayingCardViewModel>)itemsControl.ItemsSource;

            //  We've put cards temporarily in the drag stack, put them in the
            //  source stack again.
            foreach (var dragCard in _draggingCards)
            {
                playingCards.Add(dragCard);
            }

            //  If we have a drop target, move the card.
            if (args.DropTarget != null)
            {
                var dropTarget      = (ItemsControl)args.DropTarget;
                var dragPayingCards = (ObservableCollection <PlayingCardViewModel>)dropTarget.ItemsSource;
                var dragPlayingCard = (PlayingCardViewModel)args.DragData;

                //  Move the card.
                _viewModel.MoveCard(playingCards, dragPayingCards, dragPlayingCard, false);
            }
        }
Пример #11
0
        public async void LoadNeuralNet(object sender, DragAndDropEventArgs e)
        {
            IsWorking = true;
            IEnumerable <string> files;

            if (e.FilesPaths.ContainsKey(DirtyNetModel))
            {
                files = e.FilesPaths[DirtyNetModel];
                using (var task = LoadQuery <TrainedNetModel>(files))
                {
                    await task;
                }
            }
            if (e.FilesPaths.ContainsKey(CleanNetModel))
            {
                files = e.FilesPaths[CleanNetModel];
                using (var task = LoadQuery <PlainNetModel>(files))
                {
                    await task;
                }
            }
            IsWorking = false;
        }
Пример #12
0
        private void ScrollableListView_ItemDroppedEvent(object sender, DragAndDropEventArgs e)
        {
            if (Element == null)
            {
                return;
            }

            if (((DragAndDropListView)Element).DragEventUsage != DragAndDropListView.eDragAndDropEventUsage.TriggerEventOnly)
            {
                object firstItem = Items[e.StartIndex];

                if (firstItem != null)
                {
                    Items.RemoveAt(e.StartIndex);
                    Items.Insert(e.EndIndex, firstItem);
                }
            }

            if (((DragAndDropListView)Element).DragEventUsage != DragAndDropListView.eDragAndDropEventUsage.None)
            {
                ((DragAndDropListView)Element).InvokeDragEnded(e.StartIndex, e.EndIndex);
            }
        }
        void Instance_DragAndDropStart(object sender, DragAndDropEventArgs args)
        {
            //  The data should be a playing card.
            PlayingCard card = args.DragData as PlayingCard;

            if (card == null || card.IsPlayable == false)
            {
                args.Allow = false;
                return;
            }
            args.Allow = true;

            //  If the card is draggable, we're going to want to drag the whole
            //  stack.
            IList <PlayingCard> cards = ViewModel.GetCardCollection(card);

            draggingCards = new List <PlayingCard>();
            int start = cards.IndexOf(card);

            for (int i = start; i < cards.Count; i++)
            {
                draggingCards.Add(cards[i]);
            }

            //  Clear the drag stack.
            dragStack.ItemsSource = draggingCards;
            dragStack.UpdateLayout();
            args.DragAdorner = new Apex.Adorners.VisualAdorner(dragStack);

            //  Hide each dragging card.
            ItemsControl sourceStack = args.DragSource as ItemsControl;

            foreach (var dragCard in draggingCards)
            {
                ((ObservableCollection <PlayingCard>)sourceStack.ItemsSource).Remove(dragCard);
            }
        }
 public void scheduler_DragLeave(object sender, DragAndDropEventArgs e)
 {
 }
 public void grid_DragLeave(object sender, DragAndDropEventArgs e)
 {
 }
 public void grid_Drop(object sender, DragAndDropEventArgs e)
 {
     schedulerControl1.SelectedAppointments[0].Delete();
     ((IList)gridControl1.ItemsSource).Add((ScheduleTask)e.DragData);
 }
Пример #17
0
 void Instance_DragAndDropContinue(object sender, DragAndDropEventArgs args)
 {
     args.Allow = true;
 }
        void Instance_DragAndDropEnd(object sender, DragAndDropEventArgs args)
        {
            //  We've put cards temporarily in the drag stack, put them in the
            //  source stack again.
            ItemsControl sourceStack = args.DragSource as ItemsControl;
            foreach (var dragCard in draggingCards)
                ((ObservableCollection<PlayingCard>)((ItemsControl)args.DragSource).ItemsSource).Add(dragCard);

            //  If we have a drop target, move the card.
            if (args.DropTarget != null)
            {
                //  Move the card.
                ViewModel.MoveCard(
                    (ObservableCollection<PlayingCard>)((ItemsControl)args.DragSource).ItemsSource,
                    (ObservableCollection<PlayingCard>)((ItemsControl)args.DropTarget).ItemsSource,
                    (PlayingCard)args.DragData, false);
            }
        }
 void Instance_DragAndDropContinue(object sender, DragAndDropEventArgs args)
 {
     args.Allow = true;
 }
Пример #20
0
 void Instance_DragAndDropStart(object sender, DragAndDropEventArgs args)
 {
     args.Allow               = true;
     args.DragAdorner         = new VisualAdorner(args.DragElement);
     args.DragElement.Opacity = 0;
 }
        void Instance_DragAndDropStart(object sender, DragAndDropEventArgs args)
        {
            //  The data should be a playing card.
            PlayingCard card = args.DragData as PlayingCard;
            if (card == null || card.IsPlayable == false)
            {
                args.Allow = false;
                return;
            }
            args.Allow = true;

            //  If the card is draggable, we're going to want to drag the whole
            //  stack.
            IList<PlayingCard> cards = ViewModel.GetCardCollection(card);
            draggingCards = new List<PlayingCard>();
            int start = cards.IndexOf(card);
            for (int i = start; i < cards.Count; i++)
                draggingCards.Add(cards[i]);

            //  Clear the drag stack.
            dragStack.ItemsSource = draggingCards;
            dragStack.UpdateLayout();
            args.DragAdorner = new Apex.Adorners.VisualAdorner(dragStack);

            //  Hide each dragging card.
            ItemsControl sourceStack = args.DragSource as ItemsControl;
            foreach (var dragCard in draggingCards)
                ((ObservableCollection<PlayingCard>)sourceStack.ItemsSource).Remove(dragCard);
        }