Example #1
0
 private void DragCompleted()
 {
     // Hack, one of these ends up null and I'm not sure why
     try
     {
         if (_adorner == null || _adorner.Parent == null)
         {
             return;
         }
         Canvas.SetLeft(this, _adorner.LeftOffset);
         Canvas.SetTop(this, _adorner.TopOffset);
         ((AdornerLayer)_adorner.Parent).Remove(_adorner);
         _adorner = null;
         //var marker = (Marker)DataContext;
         //ushort count = _takeAll ? marker.Count : (ushort)1;
         //var e = new MarkerEventArgs(this, marker, count);
         //Mouse.DirectlyOver.RaiseEvent(e);
         //if (Keyboard.IsKeyUp(Key.LeftAlt) && !e.Handled)
         //    marker.Count -= count;
     }
     catch (Exception ex)
     {
         Log.Warn("DragCompleted", ex);
     }
 }
Example #2
0
 private void DragCompleted()
 {
     // Hack, one of these ends up null and I'm not sure why
     try
     {
         if (_adorner == null || _adorner.Parent == null)
         {
             return;
         }
         ((AdornerLayer)_adorner.Parent).Remove(_adorner);
         _adorner = null;
         var    marker = (Marker)DataContext;
         ushort count  = _takeAll ? marker.Count : (ushort)1;
         var    e      = new MarkerEventArgs(this, marker, count);
         Mouse.DirectlyOver.RaiseEvent(e);
         if (Keyboard.IsKeyUp(Key.LeftAlt) && !e.Handled)
         {
             Program.Client.Rpc.RemoveMarkerReq(marker.Card, marker.Model.Id, marker.Model.Name, count, marker.Count, false);
             marker.Card.RemoveMarker(marker, count);
         }
     }
     catch (Exception ex)
     {
         Log.Warn("DragCompleted", ex);
     }
 }
Example #3
0
        private void DragStarted()
        {
            // Hides the card view
            //RaiseEvent(new CardEventArgs(CardControl.CardHoveredEvent, this));

            UIElement adorned = this;//_takeAll ? this : (UIElement)img1;

            _mouseOffset    = TranslatePoint(_mousePt, adorned);
            _mouseOffset.X -= adorned.DesiredSize.Width / 2;
            _mouseOffset.Y -= adorned.DesiredSize.Height / 2;
            _adorner        = new Adorners.DragAdorner(adorned);
            AdornerLayer.GetAdornerLayer(_adorner.AdornedElement).Add(_adorner);
        }
Example #4
0
        private void DragCompleted()
        {
            ((AdornerLayer)_adorner.Parent).Remove(_adorner);
            _adorner = null;
            var    marker = (Marker)DataContext;
            ushort count  = _takeAll ? marker.Count : (ushort)1;
            var    e      = new MarkerEventArgs(this, marker, count);

            Mouse.DirectlyOver.RaiseEvent(e);
            if (Keyboard.IsKeyUp(Key.LeftAlt) && !e.Handled)
            {
                marker.Count -= count;
            }
        }
Example #5
0
        private void DragCompleted()
        {
            // Hack, one of these ends up null and I'm not sure why
            if (_adorner == null || _adorner.Parent == null)
            {
                return;
            }
            ((AdornerLayer)_adorner.Parent).Remove(_adorner);
            _adorner = null;
            var    marker = (Marker)DataContext;
            ushort count  = _takeAll ? marker.Count : (ushort)1;
            var    e      = new MarkerEventArgs(this, marker, count);

            Mouse.DirectlyOver.RaiseEvent(e);
            if (Keyboard.IsKeyUp(Key.LeftAlt) && !e.Handled)
            {
                marker.Count -= count;
            }
        }
Example #6
0
 private void DragCompleted()
 {
     // Hack, one of these ends up null and I'm not sure why
     try
     {
         if (_adorner == null || _adorner.Parent == null) return;
         ((AdornerLayer)_adorner.Parent).Remove(_adorner);
         _adorner = null;
         var marker = (Marker)DataContext;
         ushort count = _takeAll ? marker.Count : (ushort)1;
         var e = new MarkerEventArgs(this, marker, count);
         Mouse.DirectlyOver.RaiseEvent(e);
         if (Keyboard.IsKeyUp(Key.LeftAlt) && !e.Handled)
         {
             Program.Client.Rpc.RemoveMarkerReq(marker.Card, marker.Model.Id, marker.Model.Name, count, marker.Count, false);
             marker.Card.RemoveMarker(marker, count);
         }
     }
     catch (Exception ex)
     {
         Log.Warn("DragCompleted",ex);
     }
 }
Example #7
0
        private void DragStarted()
        {
            // Hides the card view
            RaiseEvent(new CardEventArgs(CardControl.CardHoveredEvent, this));

            _takeAll = Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift);
            UIElement adorned = _takeAll ? this : (UIElement) img1;
            _mouseOffset = TranslatePoint(_mousePt, adorned);
            _mouseOffset.X -= adorned.DesiredSize.Width/2;
            _mouseOffset.Y -= adorned.DesiredSize.Height/2;
            _adorner = new Adorners.DragAdorner(adorned);
            AdornerLayer.GetAdornerLayer(_adorner.AdornedElement).Add(_adorner);
        }
Example #8
0
        private void DragCompleted()
        {
            // Hack, one of these ends up null and I'm not sure why
            try
            {
                if (_adorner == null || _adorner.Parent == null) return;
                Canvas.SetLeft(this, _adorner.LeftOffset);
                Canvas.SetTop(this, _adorner.TopOffset);
                ((AdornerLayer)_adorner.Parent).Remove(_adorner);
                _adorner = null;
                //var marker = (Marker)DataContext;
                //ushort count = _takeAll ? marker.Count : (ushort)1;
                //var e = new MarkerEventArgs(this, marker, count);
                //Mouse.DirectlyOver.RaiseEvent(e);
                //if (Keyboard.IsKeyUp(Key.LeftAlt) && !e.Handled)
                //    marker.Count -= count;

            }
            catch (Exception ex)
            {
                Log.Warn("DragCompleted", ex);
            }
        }
Example #9
0
 private void DragCompleted()
 {
     // Hack, one of these ends up null and I'm not sure why
     if (_adorner == null || _adorner.Parent == null) return;
     ((AdornerLayer) _adorner.Parent).Remove(_adorner);
     _adorner = null;
     var marker = (Marker) DataContext;
     ushort count = _takeAll ? marker.Count : (ushort) 1;
     var e = new MarkerEventArgs(this, marker, count);
     Mouse.DirectlyOver.RaiseEvent(e);
     if (Keyboard.IsKeyUp(Key.LeftAlt) && !e.Handled)
         marker.Count -= count;
 }
Example #10
0
 private void DragCompleted()
 {
     ((AdornerLayer) _adorner.Parent).Remove(_adorner);
     _adorner = null;
     var marker = (Marker) DataContext;
     ushort count = _takeAll ? marker.Count : (ushort) 1;
     var e = new MarkerEventArgs(this, marker, count);
     Mouse.DirectlyOver.RaiseEvent(e);
     if (Keyboard.IsKeyUp(Key.LeftAlt) && !e.Handled)
         marker.Count -= count;
 }