Beispiel #1
0
        public static DockingWindow GetDockingWindowForView(this object view, DockSite dockSite)
        {
            if (view == null)
            {
                return(null);
            }

            if (view is DockingWindow)
            {
                return((DockingWindow)view);
            }

            if (dockSite == null)
            {
                return(null);
            }

            foreach (var documentWindow in dockSite.DocumentWindows)
            {
                if ((documentWindow == view) || (documentWindow.Content == view))
                {
                    return(documentWindow);
                }
            }

            foreach (var toolWindow in dockSite.ToolWindows)
            {
                if ((toolWindow == view) || (toolWindow.Content == view))
                {
                    return(toolWindow);
                }
            }

            return(null);
        }
        /// <summary>
        /// Handles the <c>WindowUnregistered</c> event of the <c>DockSite</c> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DockingWindowEventArgs"/> instance containing the event data.</param>
        private static void OnDockSiteWindowUnregistered(object sender, DockingWindowEventArgs e)
        {
            DockSite dockSite = sender as DockSite;

            if (dockSite == null)
            {
                return;
            }

            // Ensure the DockingWindow exists and is generated for an item
            DockingWindow dockingWindow = e.Window;

            if (dockingWindow == null || !dockingWindow.IsContainerForItem)
            {
                return;
            }

            // Need to remove the window from the list of windows that are waiting to be opened
            IList <DockingWindow> windowsPendingOpen = dockSite.GetValue(WindowsPendingOpenProperty) as IList <DockingWindow>;

            if (windowsPendingOpen != null)
            {
                int index = windowsPendingOpen.IndexOf(dockingWindow);
                if (index != -1)
                {
                    windowsPendingOpen.RemoveAt(index);
                }
            }
        }
			public Item(ToolWindow window, DockSite dockSite)
			{
				Window = window;

				MenuItem = new MenuItem
				{
					Header = window.Title,
					IsCheckable = true,
					IsChecked = window.IsOpen,
					Tag = window,
					Name = "MenuItem" + window.Name,
                    HorizontalContentAlignment = HorizontalAlignment.Left,
                    VerticalContentAlignment = VerticalAlignment.Center
				};

				MenuItem.Click += UpdateToolWindow;

				if (null == dockSite)
					return;

				DockSite = dockSite;

				DockSite.WindowClosed += WindowClosed;
				DockSite.WindowOpened += WindowOpened;
			}
Beispiel #4
0
		public void AddTabbedMdiHost(DockSite dockSite)
		{
			ParameterNullCheck(dockSite);

			var mdiHost = new TabbedMdiHost();
			dockSite.Workspace.Content = mdiHost;
		}
Beispiel #5
0
            public Item(ToolWindow window, DockSite dockSite)
            {
                Window = window;

                MenuItem = new MenuItem
                {
                    Header      = window.Title,
                    IsCheckable = true,
                    IsChecked   = window.IsOpen,
                    Tag         = window,
                    Name        = "MenuItem" + window.Name,
                    HorizontalContentAlignment = HorizontalAlignment.Left,
                    VerticalContentAlignment   = VerticalAlignment.Center
                };

                MenuItem.Click += UpdateToolWindow;

                if (null == dockSite)
                {
                    return;
                }

                DockSite = dockSite;

                DockSite.WindowClosed += WindowClosed;
                DockSite.WindowOpened += WindowOpened;
            }
		public void Add(ToolWindow window, DockSite dockSite)
		{
			var item = _items.FirstOrDefault(i => Equals(i.Window, window));

			if (null == item)
				_items.Add(new Item(window, dockSite));
		}
Beispiel #7
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            var layout = _settings.GetValue <string>("Layout");

            if (layout != null)
            {
                try
                {
                    DockSite.LoadLayout(layout);
                }
                catch (Exception ex)
                {
                    ex.LogError();
                }
            }

            var strategyFile = _settings.GetValue <string>("StrategyFile");

            if (!strategyFile.IsEmpty() && File.Exists(strategyFile))
            {
                LoadStrategy(strategyFile);
            }
            //else
            //{
            //	new MessageBoxBuilder()
            //		.Error()
            //		.Text("Файл стратегии не найден.")
            //		.Owner(this)
            //		.Button(MessageBoxButton.OK)
            //		.Show();
            //}
        }
        /// <summary>
        ///   Initializes a new instance of the <see cref = "DockableWindowConductor" /> class.
        /// </summary>
        /// <param name="dockSite"> </param>
        /// <param name = "viewModel">The view model.</param>
        /// <param name = "view">The view.</param>
        public DockableWindowConductor(DockSite dockSite, object viewModel, DockingWindow view)
        {
            _dockSite  = dockSite;
            _viewModel = viewModel;
            _view      = view;

            var activatable = viewModel as IActivate;

            if (activatable != null)
            {
                activatable.Activate();
            }

            var deactivatable = viewModel as IDeactivate;

            if (deactivatable != null)
            {
                _dockSite.WindowClosed += OnClosed;
                //_view.Closed += OnClosed;
                deactivatable.Deactivated += OnDeactivated;
            }

            var guard = viewModel as IGuardClose;

            if (guard != null)
            {
                _dockSite.WindowClosing += OnClosing;
            }
            //view.Closing += OnClosing;
        }
Beispiel #9
0
 public override string GetItemTag(DockSite site, AvatarController avatar, out bool usePetalTag,
                                   out string icon)
 {
     usePetalTag = false;
     icon        = "";
     return("");
 }
        public static DockingWindow GetDockingWindowForView(this object view, DockSite dockSite)
        {
            if (view == null)
                return null;

            if (view is DockingWindow)
                return (DockingWindow)view;

            if (dockSite == null)
                return null;

            foreach (var documentWindow in dockSite.DocumentWindows)
            {
                if ((documentWindow == view) || (documentWindow.Content == view))
                    return documentWindow;
            }

            foreach (var toolWindow in dockSite.ToolWindows)
            {
                if ((toolWindow == view) || (toolWindow.Content == view))
                    return toolWindow;
            }

            return null;
        }
        public TextureLayout()
        {
            InitializeComponent();

            this.Header = "Texture";
            this.Initialize(mainWindow, null);

            int x, y;

            byte[] imageData = ExternFileLoader.LoadTexture("../../resources/images/logofm3d.png", out x, out y);

            BitmapSource bitmapSource = BitmapSource.Create(x, y, 300, 300, PixelFormats.Bgra32, BitmapPalettes.Gray256, imageData, x * 4);


            Image image = new Image();

            image.Source = bitmapSource;

            SplitPanel      splitPanel = new SplitPanel();
            DockWindowGroup dg         = new DockWindowGroup();

            dg.Items.Add(new DocumentWindows.TextureViewPort(this, image));
            splitPanel.Children.Add(dg);
            DockSite.SetDock(splitPanel, Dock.Right);
            DockSite.SetDockSize(splitPanel, 150);
            this.dockSite.SplitPanels.Add(splitPanel);
            dg.UpdateVisibility();
        }
Beispiel #12
0
 private void ViewModel_PreviewHide(object sender, EventArgs e)
 {
     foreach (Window wind in DockSite.GetAllFloatWindows(this))
     {
         wind.Close();
     }
 }
Beispiel #13
0
        public static void SaveUISettings(this SettingsStorage storage, DockSite dockSite, PairSet <Tuple <string, Type>, IContentWindow> contents)
        {
            storage.SetValue("Content", contents.Select(p =>
            {
                var ctrlStorage = new SettingsStorage();

                ctrlStorage.SetValue("Id", p.Key.Item1);
                ctrlStorage.SetValue("Type", p.Value.Control.GetType().GetTypeName(false));
                ctrlStorage.SetValue("IsToolWindow", p.Value is ContentToolWindow);
                ctrlStorage.SetValue("DockingWindowName", ((DockingWindow)p.Value).Name);
                ctrlStorage.SetValue("Settings", p.Value.Control.Save());
                ctrlStorage.SetValue("TagType", p.Value.Tag == null ? null : p.Value.Tag.GetType().GetTypeName(false));

                return(ctrlStorage);
            }).ToArray());

            storage.SetValue("Layout", dockSite.SaveLayout());

            var window = dockSite.ActiveWindow;

            if (window != null)
            {
                storage.SetValue("ActiveWindow", window.UniqueId.To <string>());
            }
        }
Beispiel #14
0
        private void SaveSettings()
        {
            _settings.SetValue("Connection", _connector.BasketSessionHolder.Save());
            //_settings.SetValue("LogManager", _logManager.Save());
            _settings.SetValue("Layout", DockSite.SaveLayout());

            CultureInfo.InvariantCulture.DoInCulture(() => new XmlSerializer <SettingsStorage>().Serialize(_settings, _settingsFile));
        }
Beispiel #15
0
        public void AddTabbedMdiHost(DockSite dockSite)
        {
            ParameterNullCheck(dockSite);

            var mdiHost = new TabbedMdiHost();

            dockSite.Workspace.Content = mdiHost;
        }
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets the value of the <see cref="IsManagedProperty"/> attached property for a specified <see cref="DockSite"/>.
        /// </summary>
        /// <param name="obj">The object to which the attached property is retrieved.</param>
        /// <returns>
        /// <c>true</c> if the specified <see cref="DockSite"/> is being managed; otherwise <c>false</c>.
        /// </returns>
        public static bool GetIsManaged(DockSite obj)
        {
            if (null == obj)
            {
                throw new ArgumentNullException("obj");
            }
            return((bool)obj.GetValue(DockSiteViewModelBehavior.IsManagedProperty));
        }
 /// <summary>
 /// Sets the value of the <see cref="IsManagedProperty"/> attached property to a specified <see cref="DockSite"/>.
 /// </summary>
 /// <param name="obj">The object to which the attached property is written.</param>
 /// <param name="value">
 /// A value indicating whether the specified <see cref="DockSite"/> is being managed.
 /// </param>
 public static void SetIsManaged(DockSite obj, bool value)
 {
     if (null == obj)
     {
         throw new ArgumentNullException("obj");
     }
     obj.SetValue(DockSiteViewModelBehavior.IsManagedProperty, value);
 }
Beispiel #18
0
        public DocumentWindow CreateDocumentWindow(DockSite dockSite, string name, string title, ImageSource image,
                                                   object content)
        {
            ParameterNullCheck(dockSite);
            // Create the window (using this constructor registers the document window with the DockSite)
            var doc = new DocumentWindow(dockSite, name, title, image, content);

            return(doc);
        }
Beispiel #19
0
 private static IDockTarget GetDockTarget(DockSite dockSite, Direction direction)
 {
     if (dockSite == null)
     {
         return(null);
     }
     return(dockSite.ToolWindows.Where(o => o.GetDirectionRelativeToWorkspace() == direction).Cast <IDockTarget>().FirstOrDefault()
            ?? dockSite);
 }
Beispiel #20
0
		public DocumentWindow CreateDocumentWindow(DockSite dockSite, string name, string title, ImageSource image,
			object content)
		{
			ParameterNullCheck(dockSite);
			// Create the window (using this constructor registers the document window with the DockSite)
			var doc = new DocumentWindow(dockSite, name, title, image, content);

			return doc;
		}
Beispiel #21
0
        /// <summary>
        /// To save the Docking panel layout.
        /// </summary>
        /// <param name="dockSite">Docking panel.</param>
        /// <param name="toolWindowOnly">To save windows only.</param>
        /// <returns>Layout encoded as a string.</returns>
        public static string SaveLayout(this DockSite dockSite, bool toolWindowOnly = false)
        {
            if (dockSite == null)
            {
                throw new ArgumentNullException(nameof(dockSite));
            }

            return(CultureInfo.InvariantCulture.DoInCulture(() => CreateDockSiteSerializer(toolWindowOnly).SaveToString(dockSite)));
        }
Beispiel #22
0
        public override void Save(SettingsStorage storage)
        {
            if (Debugger != null)
            {
                storage.SetValue("DebuggerSettings", Debugger.Save());
            }

            storage.SetValue("Layout", DockSite.SaveLayout(true));
        }
Beispiel #23
0
        public void Add(ToolWindow window, DockSite dockSite)
        {
            var item = _items.FirstOrDefault(i => Equals(i.Window, window));

            if (null == item)
            {
                _items.Add(new Item(window, dockSite));
            }
        }
Beispiel #24
0
        public void DockPlacementTo(Placement placement, Placement target, DockSite site, float stretch)
        {
            if (site == DockSite.Fill)
            {
                target.SwitchType(
                    targetPanelPlacement => {
                    if (placement is TabBarPlacement tabBarPlacement)
                    {
                        DockPlacementTo(tabBarPlacement, targetPanelPlacement);
                    }
                    if (placement is PanelPlacement panelPlacement)
                    {
                        DockPlacementTo(panelPlacement, targetPanelPlacement);
                    }
                },
                    targetTabBarPlacement => {
                    if (placement is TabBarPlacement tabBarPlacement)
                    {
                        DockPlacementTo(tabBarPlacement, targetTabBarPlacement);
                    }
                    if (placement is PanelPlacement panelPlacement)
                    {
                        targetTabBarPlacement.Placements.Add(panelPlacement);
                    }
                },
                    targetSplitPlacement => targetSplitPlacement.Append(placement)
                    );
                return;
            }
            if (target.Parent is TabBarPlacement)
            {
                target = target.Parent;
            }
            var parent         = (SplitPlacement)target.Parent;
            var splitPlacement = new SplitPlacement();
            var isFirst        = site == DockSite.Left || site == DockSite.Top;
            var wasFirst       = parent.FirstChild == target;

            target.Unlink();
            if (isFirst)
            {
                splitPlacement.Initialize(placement, target, site.GetSeparator(), stretch);
            }
            else
            {
                splitPlacement.Initialize(target, placement, site.GetSeparator(), 1 - stretch);
            }
            if (wasFirst)
            {
                parent.FirstChild = splitPlacement;
            }
            else
            {
                parent.SecondChild = splitPlacement;
            }
        }
Beispiel #25
0
		public LayoutManager(MainWindow parent, DockSite dockSite)
		{
			ParameterNullCheck(dockSite);
			ParameterNullCheck(parent);

			_parent = parent;

			_dockSite = dockSite;
			_dockSite.Content = new Workspace();
		}
Beispiel #26
0
        public LayoutManager(MainWindow parent, DockSite dockSite)
        {
            ParameterNullCheck(dockSite);
            ParameterNullCheck(parent);

            _parent = parent;

            _dockSite         = dockSite;
            _dockSite.Content = new Workspace();
        }
Beispiel #27
0
        public void AttachDockBar(DockSite dockSite)
        {
            this.bar1.Controls.Remove(this.panelDockContainer1);
            this.bar1.Items.Remove(this.dockContainerItem1);

            var bar = dockSite.Controls[0] as Bar;

            bar.Controls.Add(this.panelDockContainer1);
            bar.Items.Add(this.dockContainerItem1);
        }
Beispiel #28
0
        public PanelPlacement AddPanel(Panel panel, Placement targetPlacement, DockSite site, float stretch)
        {
            var placement = new PanelPlacement {
                Id = panel.Id, Title = panel.Title
            };

            DockPlacementTo(placement, targetPlacement, site, stretch);
            Panels.Add(panel);
            return(placement);
        }
Beispiel #29
0
        private void RefreshPlacementAndSite()
        {
            var mousePosition = Application.DesktopMousePosition;
            var offset        = positionOffset;

            if (Application.Platform == PlatformId.Mac)
            {
                mousePosition.Y -= windowPlacement.WindowWidget.Window.DecoratedSize.Y;
                offset.Y         = -offset.Y;
            }
            ResetDockComponents();
            var cachedSite = requestedSite;

            requestedSite = DockSite.None;
            windowPlacement.WindowWidget.Window.ClientPosition = mousePosition - offset;
            foreach (var p in GetPanels())
            {
                var placement    = AppPlacement.FindPanelPlacement(p.Id);
                var bounds       = p.PanelWidget.CalcAABBInWindowSpace();
                var winPlacement = DockManager.Instance.Model.GetWindowByPlacement(placement);
                var requestedDockingComponent = winPlacement.WindowWidget.Components.Get <RequestedDockingComponent>();
                if (requestedDockingComponent == null)
                {
                    continue;
                }
                var clientMousePos = winPlacement.WindowWidget.Window.Input.MousePosition;
                if (!bounds.Contains(clientMousePos))
                {
                    continue;
                }
                CalcSiteAndRect(clientMousePos, bounds, out DockSite site, out Rectangle? rect);
                if (placement.Id == windowPlacement.Root.GetPanelPlacements().First().Id ||
                    placement.Id == DockManager.DocumentAreaId &&
                    site == DockSite.Fill
                    )
                {
                    site = DockSite.None;
                    rect = null;
                    requestedPlacement = null;
                }
                if (cachedSite != site || requestedPlacement?.Id != placement.Id)
                {
                    DockHierarchy.Instance.InvalidateWindows();
                }
                requestedSite = site;
                requestedDockingComponent.Bounds = rect;
                requestedPlacement = placement;
                break;
            }
            if (cachedSite != requestedSite)
            {
                DockHierarchy.Instance.InvalidateWindows();
            }
        }
Beispiel #30
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Settings storage.</param>
        public void Load(SettingsStorage storage)
        {
            ErrorsGrid.Load(storage.GetValue <SettingsStorage>("ErrorsGrid"));

            var layout = storage.GetValue <string>("Layout");

            if (layout != null)
            {
                DockSite.LoadLayout(layout, true);
            }
        }
Beispiel #31
0
        private void startFileBrowser()
        {
            SplitPanel      splitPanel = new SplitPanel();
            DockWindowGroup dg         = new DockWindowGroup();

            dg.Items.Add(this.fileBrowser = new ToolWindows.FileBrowser.View(this));
            splitPanel.Children.Add(dg);
            DockSite.SetDock(splitPanel, Dock.Right);
            DockSite.SetDockSize(splitPanel, 200);
            this.dockSite.SplitPanels.Add(splitPanel);
            dg.UpdateVisibility();
        }
Beispiel #32
0
        public void OpenTextEditor(object sender, RoutedEventArgs e)
        {
            SplitPanel      splitPanel = new SplitPanel();
            DockWindowGroup dg         = new DockWindowGroup();

            dg.Items.Add(new ToolWindows.TextEditor.TextEditor(this));
            splitPanel.Children.Add(dg);
            DockSite.SetDock(splitPanel, Dock.Right);
            DockSite.SetDockSize(splitPanel, 600);
            this.dockSite.SplitPanels.Add(splitPanel);
            dg.UpdateVisibility();
        }
Beispiel #33
0
 public void DockToolWindowToDockSite(DockSite dockSite, ToolWindow toolWindow, Dock dock)
 {
     ParameterNullCheck(dockSite);
     try
     {
         toolWindow.Dock(dockSite, dock);
     }
     catch (Exception e)
     {
         throw new InvalidOperationException("Invalid dock site.");
     }
 }
Beispiel #34
0
        public void startCreateProject(Dock dock, int docksize)
        {
            SplitPanel      splitPanel = new SplitPanel();
            DockWindowGroup dg         = new DockWindowGroup();

            dg.Items.Add(new ToolWindows.TextEditor.TextEditor(this));
            splitPanel.Children.Add(dg);
            DockSite.SetDock(splitPanel, dock);
            DockSite.SetDockSize(splitPanel, docksize);
            this.dockSite.SplitPanels.Add(splitPanel);
            dg.UpdateVisibility();
        }
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // NON-PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Gets the first <see cref="ToolWindow"/> associated with the specified dock group.
        /// </summary>
        /// <param name="dockSite">The dock site to search.</param>
        /// <param name="dockGroup">The dock group.</param>
        /// <returns>
        /// A <see cref="ToolWindow"/>; otherwise, <see langword="null"/>.
        /// </returns>
        private static ToolWindow GetToolWindow(DockSite dockSite, string dockGroup)
        {
            if (dockSite != null && !string.IsNullOrEmpty(dockGroup)) {
                foreach (ToolWindow toolWindow in dockSite.ToolWindows) {
                    ToolItemViewModel toolItemViewModel = toolWindow.DataContext as ToolItemViewModel;
                    if (toolItemViewModel != null && toolItemViewModel.DockGroup == dockGroup)
                        return toolWindow;
                }
            }

            return null;
        }
Beispiel #36
0
        public override void Load(SettingsStorage storage)
        {
            _debuggerSettings = storage.GetValue <SettingsStorage>("DebuggerSettings");
            SafeLoadDebuggerSettings();

            var layout = storage.GetValue <string>("Layout");

            if (layout != null)
            {
                DockSite.LoadLayout(layout, true);
            }
        }
Beispiel #37
0
 private void ViewModel_PreviewShow(object sender, EventArgs e)
 {
     foreach (Window wind in DockSite.GetAllFloatWindows(this))
     {
         if (wind.WindowState == WindowState.Minimized)
         {
             wind.WindowState = WindowState.Normal;
         }
         wind.Show();
         wind.Activate();
         wind.Focus(); // needs focus so the Esc key will close (hide) the preview
     }
 }
		void IComponentConnector.Connect(int connectionId, object target)
		{
			switch (connectionId)
			{
				case 1:
					button_0 = (ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target;
					button_0.Click += new EventHandler<ExecuteRoutedEventArgs>(method9);
					break;
				case 2:
					((ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target).Click += new EventHandler<ExecuteRoutedEventArgs>(buttonOpen_Click);
					break;
				case 3:
					((ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target).Click += new EventHandler<ExecuteRoutedEventArgs>(buttonSave_Click);
					break;
				case 4:
					((ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target).Click += new EventHandler<ExecuteRoutedEventArgs>(buttonReanalyze_Click);
					break;
				case 5:
					((ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target).Click += new EventHandler<ExecuteRoutedEventArgs>(buttonWheel_Click);
					break;
				case 6:
					this.group_0 = (Group)target;
					break;
				case 7:
					((ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target).Click += new EventHandler<ExecuteRoutedEventArgs>(method2);
					break;
				case 8:
					this.dockSite = (DockSite)target;
					break;
				case 9:
					this.toolWindow = (ToolWindow)target;
					break;
				case 10:
					this.noScrollTreeView = (NoScrollTreeView)target;
					break;
				case 11:
					this.toolWindow1 = (ToolWindow)target;
					break;
				case 12:
					this.toolWindow2 = (ToolWindow)target;
					break;
				case 13:
					this.toolWindow3 = (ToolWindow)target;
					break;
				case 14:
					((System.Windows.Controls.Button)target).Click += button0_Click;
					break;
				case 15:
					((System.Windows.Controls.Button)target).Click += button1_Click;
					break;
				case 16:
					((System.Windows.Controls.Button)target).Click += button2_Click;
					break;
				case 17:
					((System.Windows.Controls.Button)target).Click += button3_Click;
					break;
				case 18:
					((System.Windows.Controls.Button)target).Click += button4_Click;
					break;
				default:
					this._isInitialized = true;
					break;
			}
		}
 /// <summary>
 /// Sets the value of the <see cref="IsManagedProperty"/> attached property to a specified <see cref="DockSite"/>.
 /// </summary>
 /// <param name="obj">The object to which the attached property is written.</param>
 /// <param name="value">
 /// A value indicating whether the specified <see cref="DockSite"/> is being managed.
 /// </param>
 public static void SetIsManaged(DockSite obj, bool value)
 {
     if (null == obj) throw new ArgumentNullException("obj");
     obj.SetValue(DockSiteViewModelBehavior.IsManagedProperty, value);
 }
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 // PUBLIC PROCEDURES
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Gets the value of the <see cref="IsManagedProperty"/> attached property for a specified <see cref="DockSite"/>.
 /// </summary>
 /// <param name="obj">The object to which the attached property is retrieved.</param>
 /// <returns>
 /// <c>true</c> if the specified <see cref="DockSite"/> is being managed; otherwise <c>false</c>.
 /// </returns>
 public static bool GetIsManaged(DockSite obj)
 {
     if (null == obj) throw new ArgumentNullException("obj");
     return (bool)obj.GetValue(DockSiteViewModelBehavior.IsManagedProperty);
 }
        private void CreateDockBar(DockSite parentSite)
        {
            IDesignerHost dh = this.GetService(typeof(IDesignerHost)) as IDesignerHost;
            if (dh == null) return;
            IComponentChangeService cc = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
            DotNetBarManager dm = this.Component as DotNetBarManager;

            DesignerTransaction dt = dh.CreateTransaction("Creating Dock Bar");
            try
            {
                // Make sure that DockSite has document manager
                if (parentSite.DocumentDockContainer == null)
                    TypeDescriptor.GetProperties(parentSite)["DocumentDockContainer"].SetValue(parentSite, new DocumentDockContainer());

                Bar bar = dh.CreateComponent(typeof(Bar)) as Bar;
                bar.AutoSyncBarCaption = true;
                bar.CloseSingleTab = true;
                bar.CanDockDocument = false;
                bar.Style = dm.Style;
                bar.LayoutType = eLayoutType.DockContainer;
                bar.GrabHandleStyle = eGrabHandleStyle.Caption;
                bar.Stretch = true;

                // Add Dock Container to it...
                DockContainerItem dockItem = dh.CreateComponent(typeof(DockContainerItem)) as DockContainerItem;
                dockItem.Text = dockItem.Name;
                bar.Items.Add(dockItem);

                // Panel for DockContainerItem
                PanelDockContainer panel = dh.CreateComponent(typeof(PanelDockContainer)) as PanelDockContainer;
                bar.Controls.Add(panel);
                panel.ColorSchemeStyle = bar.Style;
                panel.ApplyLabelStyle();
                dockItem.Control = panel;
                bar.SelectedDockTab = 0;

                // Add them to the dock manager
                cc.OnComponentChanging(parentSite, null);

                parentSite.GetDocumentUIManager().Dock(bar);

                parentSite.RecalcLayout();

                cc.OnComponentChanged(parentSite, null, null, null);
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if (!dt.Canceled)
                    dt.Commit();
            }
        }
		void IComponentConnector.Connect(int connectionId, object target)
		{
			switch (connectionId)
			{
			case 1:
				this.button_0 = (ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target;
				this.button_0.Click += new EventHandler<ExecuteRoutedEventArgs>(this.method_9);
				break;
			case 2:
				((ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target).Click += new EventHandler<ExecuteRoutedEventArgs>(this.method_11);
				break;
			case 3:
				((ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target).Click += new EventHandler<ExecuteRoutedEventArgs>(this.method_12);
				break;
			case 4:
				((ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target).Click += new EventHandler<ExecuteRoutedEventArgs>(this.method_13);
				break;
			case 5:
				((ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target).Click += new EventHandler<ExecuteRoutedEventArgs>(this.method_15);
				break;
			case 6:
				this.group_0 = (Group)target;
				break;
			case 7:
				((ActiproSoftware.Windows.Controls.Ribbon.Controls.Button)target).Click += new EventHandler<ExecuteRoutedEventArgs>(this.method_2);
				break;
			case 8:
				this.dockSite_0 = (DockSite)target;
				break;
			case 9:
				this.toolWindow_0 = (ToolWindow)target;
				break;
			case 10:
				this.noScrollTreeView_0 = (NoScrollTreeView)target;
				break;
			case 11:
				this.toolWindow_1 = (ToolWindow)target;
				break;
			case 12:
				this.toolWindow_2 = (ToolWindow)target;
				break;
			case 13:
				this.toolWindow_3 = (ToolWindow)target;
				break;
			case 14:
				((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.method_4);
				break;
			case 15:
				((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.method_5);
				break;
			case 16:
				((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.method_8);
				break;
			case 17:
				((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.method_6);
				break;
			case 18:
				((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.method_7);
				break;
			default:
				this.bool_1 = true;
				break;
			}
		}
Beispiel #43
0
		private void CreateToolWindow(DockSite dockSite, string title, string name, object content, bool canClose = false)
		{
			var wnd = new ToolWindow(dockSite)
			{
				Name = name,
				Title = title,
				Content = content,
				CanClose = canClose
			};
			ToolItems.Add(wnd);
			OpenDockingWindow(wnd);
			//return wnd;
		}
Beispiel #44
0
		public void DockToolWindowToDockSite(DockSite dockSite, ToolWindow toolWindow, Dock dock)
		{
			ParameterNullCheck(dockSite);
			try
			{
				toolWindow.Dock(dockSite, dock);
			}
			catch (Exception e)
			{
				throw new InvalidOperationException("Invalid dock site.");
			}
		}