Esempio n. 1
0
 private void TasksText_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (!_startMove)
     {
         var overATask = false;
         var mouse     = e.GetPosition(null);
         var x         = mouse.X + this.Left - 5;
         var y         = mouse.Y + this.Top - 2;
         foreach (var window in Application.Current.Windows)
         {
             if (!(window is TaskWindow task))
             {
                 continue;
             }
             if (!(task.Top < y) || !(y < task.Top + task.Height) || !(task.Left < x) ||
                 !(x < task.Left + task.Width))
             {
                 continue;
             }
             _taskViewModel.RemoveTask(_taskTransfer.Task.Id);
             task.DragDropTask(_taskTransfer.Task);
             overATask = true;
         }
         if (!overATask)
         {
             _taskViewModel.Tasks.Add(_taskTransfer.Task);
         }
         _taskText = null;
         _taskTransfer.Close();
         _taskTransfer = null;
     }
     _startMove = false;
 }
Esempio n. 2
0
        private void TasksText_OnPreviewMouseMove(object sender, MouseEventArgs e)
        {
            if (!_startMove || _taskText == null)
            {
                if (_taskTransfer != null)
                {
                    var mousePos = e.GetPosition(null);
                    _taskTransfer.Left = mousePos.X + this.Left - 5;
                    _taskTransfer.Top  = mousePos.Y + this.Top - 2;
                }
                return;
            }
            var mouse = e.GetPosition(null);

            _taskTransfer = new TaskTransfer(_taskText)
            {
                Width = this.Width,
                Left  = mouse.X + this.Left - 5,
                Top   = mouse.Y + this.Top - 2
            };
            _taskTransfer.Show();
            _taskViewModel.Tasks.Remove(_taskText);
            _startMove = false;
        }