Beispiel #1
0
 protected override void Click(PointerReleasedEventArgs e)
 {
     if (e.MouseButton == MouseButton.Left)
     {
         AddContextMenu.Open(Icon);
     }
     else if (e.MouseButton == MouseButton.Right)
     {
         DeviceContextMenu.Open(Icon);
     }
 }
Beispiel #2
0
        protected override void Unloaded(object sender, VisualTreeAttachmentEventArgs e)
        {
            Added  = null;
            Action = null;

            AddContextMenu.RemoveHandler(MenuItem.ClickEvent, AddContextMenu_Click);
            DeviceContextMenu.RemoveHandler(MenuItem.ClickEvent, DeviceContextMenu_Click);

            AddContextMenu = DeviceContextMenu = null;

            base.Unloaded(sender, e);
        }
Beispiel #3
0
        public DeviceAdd()
        {
            InitializeComponent();

            AllowRightClick = true;
            base.MouseLeave(this, null);

            AddContextMenu = (ContextMenu)this.Resources["AddContextMenu"];
            AddContextMenu.AddHandler(MenuItem.ClickEvent, AddContextMenu_Click);

            DeviceContextMenu = (ContextMenu)this.Resources["DeviceContextMenu"];
            DeviceContextMenu.AddHandler(MenuItem.ClickEvent, DeviceContextMenu_Click);
        }
Beispiel #4
0
        protected override void Unloaded(object sender, VisualTreeAttachmentEventArgs e)
        {
            base.ResetEvents();

            SpecificViewer = null;
            _device.Viewer = null;
            _device        = null;

            DeviceContextMenu.RemoveHandler(MenuItem.ClickEvent, ContextMenu_Click);
            GroupContextMenu.RemoveHandler(MenuItem.ClickEvent, ContextMenu_Click);
            DeviceContextMenu = GroupContextMenu = null;

            this.RemoveHandler(DragDrop.DropEvent, Drop);
            this.RemoveHandler(DragDrop.DragOverEvent, DragOver);
        }
Beispiel #5
0
        public CollapsedDeviceViewer(Device device)
        {
            TitleText.Text = device.GetType().ToString().Split(".").Last();

            _device        = device;
            _device.Viewer = this;
            Deselect();

            DeviceContextMenu = (ContextMenu)this.Resources["DeviceContextMenu"];
            GroupContextMenu  = (ContextMenu)this.Resources["GroupContextMenu"];

            DeviceContextMenu.AddHandler(MenuItem.ClickEvent, ContextMenu_Click);
            GroupContextMenu.AddHandler(MenuItem.ClickEvent, ContextMenu_Click);

            this.AddHandler(DragDrop.DropEvent, Drop);
            this.AddHandler(DragDrop.DragOverEvent, DragOver);

            SetEnabled();
        }