Beispiel #1
0
        private void CopyRenderings([NotNull] DragEventArgs e)
        {
            Debug.ArgumentNotNull(e, nameof(e));

            var placeHolderTreeViewItem = GetParentTreeViewItem() as PlaceHolderTreeViewItem;

            if (placeHolderTreeViewItem == null)
            {
                return;
            }

            var treeViewIndex  = placeHolderTreeViewItem.Items.IndexOf(this);
            var renderingIndex = DeviceTreeViewItem.Device.Renderings.IndexOf(Rendering);

            if (adorner.LastPosition == ControlDragAdornerPosition.Bottom)
            {
                treeViewIndex++;
                renderingIndex++;
            }

            var items = (IEnumerable <BaseTreeViewItem>)e.Data.GetData(LayoutDesigner.DragIdentifier);

            foreach (var item in items.OfType <RenderingTreeViewItem>())
            {
                var renderingTreeViewItem = DeviceTreeViewItem.AddRendering(placeHolderTreeViewItem, item, treeViewIndex, renderingIndex);
                renderingTreeViewItem.Rendering.CopyFrom(item.Rendering);
                renderingTreeViewItem.Rendering.PlaceholderKey.Key = placeHolderTreeViewItem.PlaceHolderName;
            }
        }
Beispiel #2
0
        private void TrackPlaceHolder()
        {
            var placeHolderName         = Rendering.PlaceholderKey.ToString();
            var placeHolderTreeViewItem = DeviceTreeViewItem.FindPlaceHolderTreeViewItem(placeHolderName) as BaseTreeViewItem;

            if (placeHolderTreeViewItem == null)
            {
                placeHolderTreeViewItem = new TempPlaceHolderTreeViewItem(DeviceTreeViewItem, placeHolderName)
                {
                    IsExpanded = true
                };

                DeviceTreeViewItem.Items.Add(placeHolderTreeViewItem);
            }

            var parent = GetParentTreeViewItem() as BaseTreeViewItem;

            Remove();

            if (parent is TempPlaceHolderTreeViewItem && parent.Items.Count == 0)
            {
                parent.Remove();
            }

            placeHolderTreeViewItem.Items.Add(this);

            placeHolderTreeViewItem.IsSelected = true;
        }
Beispiel #3
0
        private void DropItems([NotNull] DragEventArgs e)
        {
            Debug.ArgumentNotNull(e, nameof(e));

            var items = (IEnumerable <IItem>)e.Data.GetData(DragManager.DragIdentifier);

            RenderingTreeViewItem rendering = null;

            foreach (var item in items)
            {
                var r = DeviceTreeViewItem.AddRendering(this, item, -1, -1);

                if (rendering == null)
                {
                    rendering = r;
                }
            }

            if (rendering == null)
            {
                return;
            }

            rendering.BringIntoView();
            rendering.Focus();
            Keyboard.Focus(rendering);
        }
        public TempPlaceHolderTreeViewItem([NotNull] DeviceTreeViewItem deviceTreeViewItem, [NotNull] string placeHolderName)
        {
            Assert.ArgumentNotNull(deviceTreeViewItem, nameof(deviceTreeViewItem));
            Assert.ArgumentNotNull(placeHolderName, nameof(placeHolderName));

            DeviceTreeViewItem = deviceTreeViewItem;
            Text        = placeHolderName;
            Icon        = new Icon("/Resources/16x16/Window.png");
            DataContext = this;

            Loaded += ControlLoaded;
        }
        private void RenderLayout()
        {
            Items.Clear();

            foreach (var device in PageModel.Devices)
            {
                var deviceTreeViewItem = new DeviceTreeViewItem(this, device);
                deviceTreeViewItem.IsExpanded = AppHost.Settings.GetBool(LayoutTreeView.LayoutDesignerTreeviewDevices, deviceTreeViewItem.Text, deviceTreeViewItem.Text == "Default");
                Items.Add(deviceTreeViewItem);

                deviceTreeViewItem.RenderRenderings();
            }
        }
Beispiel #6
0
        private void CopyRenderings([NotNull] DragEventArgs e)
        {
            Debug.ArgumentNotNull(e, nameof(e));

            var items = (IEnumerable <BaseTreeViewItem>)e.Data.GetData(LayoutDesigner.DragIdentifier);

            foreach (var item in items.OfType <RenderingTreeViewItem>())
            {
                var renderingTreeViewItem = DeviceTreeViewItem.AddRendering(this, item.Rendering, -1, -1);
                renderingTreeViewItem.Rendering.CopyFrom(item.Rendering);
                renderingTreeViewItem.Rendering.PlaceholderKey.Key = PlaceHolderName;
            }
        }
Beispiel #7
0
        public PlaceHolderTreeViewItem([NotNull] DeviceTreeViewItem deviceTreeViewItem, [NotNull] string placeHolderName)
        {
            Assert.ArgumentNotNull(deviceTreeViewItem, nameof(deviceTreeViewItem));
            Assert.ArgumentNotNull(placeHolderName, nameof(placeHolderName));

            DeviceTreeViewItem = deviceTreeViewItem;
            PlaceHolderName    = placeHolderName;
            Text        = placeHolderName + " : Placeholder";
            Icon        = new Icon("Resources/16x16/bullet_square_grey.png");
            DataContext = this;

            _adorner = new ControlDragAdorner(ItemHeader, ControlDragAdornerPosition.All);

            Loaded += ControlLoaded;
        }
Beispiel #8
0
        public RenderingTreeViewItem([NotNull] DeviceTreeViewItem deviceTreeViewItem, [NotNull] RenderingItem rendering)
        {
            Assert.ArgumentNotNull(deviceTreeViewItem, nameof(deviceTreeViewItem));
            Assert.ArgumentNotNull(rendering, nameof(rendering));

            DeviceTreeViewItem = deviceTreeViewItem;
            Rendering          = rendering;
            Icon        = rendering.Icon;
            Text        = rendering.GetDisplayName() + " : " + rendering.Name;
            DataContext = this;

            Rendering.PropertyChanged += HandlePropertyChanged;

            adorner = new ControlDragAdorner(ItemHeader, ControlDragAdornerPosition.All);

            Loaded += ControlLoaded;
        }
Beispiel #9
0
        private void DropItems([NotNull] DragEventArgs e)
        {
            Debug.ArgumentNotNull(e, nameof(e));

            var placeHolderTreeViewItem = GetParentTreeViewItem() as PlaceHolderTreeViewItem;

            if (placeHolderTreeViewItem == null)
            {
                return;
            }

            var treeViewIndex  = placeHolderTreeViewItem.Items.IndexOf(this);
            var renderingIndex = DeviceTreeViewItem.Device.Renderings.IndexOf(Rendering);

            if (adorner.LastPosition == ControlDragAdornerPosition.Bottom)
            {
                treeViewIndex++;
                renderingIndex++;
            }

            var items = (IEnumerable <IItem>)e.Data.GetData(DragManager.DragIdentifier);

            RenderingTreeViewItem rendering = null;

            foreach (var item in items)
            {
                var r = DeviceTreeViewItem.AddRendering(placeHolderTreeViewItem, item, treeViewIndex, renderingIndex);

                if (rendering == null)
                {
                    rendering = r;
                }
            }

            if (rendering == null)
            {
                return;
            }

            rendering.BringIntoView();
            rendering.Focus();
            Keyboard.Focus(rendering);
        }