Ejemplo n.º 1
0
        protected override void TogglePinStatusExecuted(TabModel _)
        {
            var container = ParentContainer; //keep an instance because it will get nulled at the end

            foreach (var item in Children.ToList())
            {
                Children.Remove(item);
                item.IsActive = true;

                if (Dock == Dock.Left)
                {
                    container.LeftDockItems.Add(item);
                }
                else if (Dock == Dock.Top)
                {
                    container.TopDockItems.Add(item);
                }
                else if (Dock == Dock.Right)
                {
                    container.RightDockItems.Add(item);
                }
                else if (Dock == Dock.Bottom)
                {
                    container.BottomDockItems.Add(item);
                }
            }
        }
Ejemplo n.º 2
0
 private void CloseTabExecuted(TabModel item)
 {
     LeftDockItems.Remove(SelectedDockItem);
     TopDockItems.Remove(SelectedDockItem);
     RightDockItems.Remove(SelectedDockItem);
     BottomDockItems.Remove(SelectedDockItem);
 }
Ejemplo n.º 3
0
        public void AddTool2(TabModel item, Dock targetDock, GridLength defaultSize)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }
            if (item.Usage == TabItemType.Document)
            {
                throw new InvalidOperationException();
            }

            var well = AllTabs.Where(t => (t.Parent as ToolWellModel)?.Dock == targetDock)
                       .Select(t => t.Parent as ToolWellModel)
                       .FirstOrDefault();

            if (well == null)
            {
                well = new ToolWellModel {
                    Dock = targetDock
                };
                var branch = new SplitPanelModel(targetDock, well);
                well.PanelSize = defaultSize;

                var temp = content;
                Content = branch;
                branch.Add(temp);
            }

            well.Children.Add(item);
            well.SelectedItem = item;
            well.IsActive     = true;
        }
Ejemplo n.º 4
0
        public void AddTool(TabModel item, TabOwnerModelBase target, Dock dock)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            var group = new ToolWellModel()
            {
                Width = item.Width, Height = item.Height, Dock = dock
            };

            group.Children.Add(item);

            var container = new SplitPanelModel(dock, group);

            if (target == null)
            {
                target  = Content;
                Content = container;
            }
            else if (target.ParentBranch != null)
            {
                target.ParentBranch.Replace(target, container);
            }
            else
            {
                System.Diagnostics.Debugger.Break();
                throw new InvalidOperationException();
            }

            container.Add(target);
        }
Ejemplo n.º 5
0
        protected virtual void CloseTabExecuted(TabModel item)
        {
            var parent = ParentContainer;

            item = item ?? SelectedItem;
            Children.Remove(item);
            item.Dispose();

            if (parent != null && parent.IsRafted && !parent.AllTabs.Any())
            {
                parent.Host.Close();
            }
        }
Ejemplo n.º 6
0
        public void AddItem(TabModel item)
        {
            var container = Children.OrderByDescending(c => c.IsActive).FirstOrDefault();

            if (container == null)
            {
                container = new DocumentWellModel();
                Children.Add(container);
            }

            container.Children.Insert(0, item);
            container.SelectedItem = item;
            container.IsActive     = true;
        }
Ejemplo n.º 7
0
 private void TogglePinStatusExecuted(TabModel item)
 {
     item = SelectedDockItem;
     if (LeftDockItems.Contains(item))
     {
         LeftDockItems.Remove(item);
         AddTool(item, null, Dock.Left);
     }
     else if (TopDockItems.Contains(item))
     {
         TopDockItems.Remove(item);
         AddTool(item, null, Dock.Top);
     }
     else if (RightDockItems.Contains(item))
     {
         RightDockItems.Remove(item);
         AddTool(item, null, Dock.Right);
     }
     else if (BottomDockItems.Contains(item))
     {
         BottomDockItems.Remove(item);
         AddTool(item, null, Dock.Bottom);
     }
 }
Ejemplo n.º 8
0
 protected override void TogglePinStatusExecuted(TabModel item)
 {
     item.IsPinned = !item.IsPinned;
 }
Ejemplo n.º 9
0
 protected virtual void SelectItemExecuted(TabModel item)
 {
     SelectedItem = item;
 }
Ejemplo n.º 10
0
 protected virtual void TogglePinStatusExecuted(TabModel item)
 {
 }