示例#1
0
        public async void Drag(object sender, PointerPressedEventArgs e)
        {
            PointerUpdateKind MouseButton = e.GetCurrentPoint(this).Properties.PointerUpdateKind;

            if (!selected)
            {
                Select(e);
            }

            DataObject dragData = new DataObject();

            dragData.Set("device", Track.Get(_device)?.Window?.Selection.Selection);

            App.Dragging = true;
            DragDropEffects result = await DragDrop.DoDragDrop(e, dragData, DragDropEffects.Move);

            App.Dragging = false;

            if (result == DragDropEffects.None)
            {
                if (selected)
                {
                    Select(e);
                }

                if (MouseButton == PointerUpdateKind.RightButtonPressed)
                {
                    ApolloContextMenu menu      = DeviceContextMenu;
                    List <ISelect>    selection = Track.Get(_device)?.Window?.Selection.Selection;

                    if (selection.Count == 1)
                    {
                        if (selection[0] is Group group && group.Count == 1)
                        {
                            menu = GroupContextMenu;
                        }

                        else if (selection[0] is Choke)
                        {
                            menu = ChokeContextMenu;
                        }
                    }

                    DeviceMute.Header = GroupMute.Header = ChokeMute.Header = ((Device)selection.First()).Enabled? "Mute" : "Unmute";

                    menu.Open(Draggable);
                }
                else if (MouseButton == PointerUpdateKind.LeftButtonPressed && e.ClickCount == 2)
                {
                    _device.Collapsed = !_device.Collapsed;
                    DeviceCollapsed?.Invoke(_device.ParentIndex.Value);
                }
            }
示例#2
0
        public async void Drag(object sender, PointerPressedEventArgs e)
        {
            if (!selected)
            {
                Select(e);
            }

            DataObject dragData = new DataObject();

            dragData.Set("device", Track.Get(_device)?.Window?.Selection.Selection);

            DragDropEffects result = await DragDrop.DoDragDrop(dragData, DragDropEffects.Move);

            if (result == DragDropEffects.None)
            {
                if (selected)
                {
                    Select(e);
                }

                if (e.MouseButton == MouseButton.Right)
                {
                    ContextMenu    menu      = DeviceContextMenu;
                    List <ISelect> selection = Track.Get(_device)?.Window?.Selection.Selection;

                    if (selection.Count == 1 && selection[0].GetType() == typeof(Group) && ((Group)selection[0]).Count == 1)
                    {
                        menu = GroupContextMenu;
                    }

                    DeviceMute.Header = GroupMute.Header = ((Device)selection.First()).Enabled? "Mute" : "Unmute";

                    menu.Open(Draggable);
                }
                else if (e.MouseButton == MouseButton.Left && e.ClickCount == 2)
                {
                    _device.Collapsed = !_device.Collapsed;
                    DeviceCollapsed?.Invoke(_device.ParentIndex.Value);
                }
            }
        }