Esempio n. 1
0
        public DeviceViewer(Device device)
        {
            InitializeComponent();

            TitleText.Text = device.Name;

            _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);

            SpecificViewer = GetSpecificViewer(this, _device);

            if (SpecificViewer != null)
            {
                this.Get <Grid>("Contents").Children.Add(SpecificViewer);
            }

            SetEnabled();
        }
Esempio n. 2
0
        protected virtual void Unloaded(object sender, VisualTreeAttachmentEventArgs e)
        {
            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);
        }
Esempio n. 3
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();
        }