Exemplo n.º 1
0
        public void OpenDocumentWindow(BaseStudioControl content, bool canClose = true)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            var document = _documents.TryGetValue(content.Key);

            if (document == null)
            {
                content.Changed += OnBaseStudioControlChanged;

                document = new LayoutDocument
                {
                    ContentId = content.Key,
                    Content   = content,
                    CanClose  = canClose
                };

                document.SetBindings(LayoutContent.TitleProperty, content, "Title");

                _documents.Add(content.Key, document);

                TabGroups.First().Children.Add(document);
                OnBaseStudioControlChanged(content);
            }

            DockingManager.ActiveContent = document.Content;
        }
Exemplo n.º 2
0
        //public void OpenToolWindow(string key, string title, object content, bool canClose = true)
        //{
        //	if (key == null)
        //		throw new ArgumentNullException(nameof(key));

        //	if (title == null)
        //		throw new ArgumentNullException(nameof(title));

        //	if (content == null)
        //		throw new ArgumentNullException(nameof(content));

        //	var anchorable = _anchorables.TryGetValue(key);

        //	if (anchorable == null)
        //	{
        //		anchorable = new LayoutAnchorable
        //		{
        //			ContentId = key,
        //			Title = title,
        //			Content = content,
        //			CanClose = canClose
        //		};

        //		_anchorables.Add(key, anchorable);
        //		//RootGroup.Children.Add(new LayoutAnchorablePane(anchorable));
        //	}

        //	//DockingManager.ActiveContent = anchorable.Content;
        //}

        //public void OpenToolWindow(BaseStudioControl content, bool canClose = true)
        //{
        //	if (content == null)
        //		throw new ArgumentNullException(nameof(content));

        //	var anchorable = _anchorables.TryGetValue(content.Key);

        //	if (anchorable == null)
        //	{
        //		content.Changed += OnBaseStudioControlChanged;

        //		anchorable = new LayoutAnchorable
        //		{
        //			ContentId = content.Key,
        //			Content = content,
        //			CanClose = canClose
        //		};

        //		anchorable.SetBindings(LayoutContent.TitleProperty, content, "Title");

        //		_anchorables.Add(content.Key, anchorable);

        //		//RootGroup.Children.Add(new LayoutAnchorablePane(anchorable));
        //		OnBaseStudioControlChanged(content);
        //	}

        //	//DockingManager.ActiveContent = anchorable.Content;
        //}

        //public void OpenDocumentWindow(string key, string title, object content, bool canClose = true)
        //{
        //	if (key == null)
        //		throw new ArgumentNullException(nameof(key));

        //	if (title == null)
        //		throw new ArgumentNullException(nameof(title));

        //	if (content == null)
        //		throw new ArgumentNullException(nameof(content));

        //	var document = _documents.TryGetValue(key);

        //	if (document == null)
        //	{
        //		//document = new LayoutDocument
        //		//{
        //		//	ContentId = key,
        //		//	Title = title,
        //		//	Content = content,
        //		//	CanClose = canClose
        //		//};

        //		//_documents.Add(key, document);

        //		var panel = DockingManager.DockController.AddDocumentPanel(_documentGroup);

        //		panel.Content = content;
        //		panel.ShowCloseButton = canClose;

        //		//TabGroups.First().Children.Add(document);
        //	}

        //	//DockingManager.ActiveContent = document.Content;
        //}

        public void OpenDocumentWindow(BaseStudioControl content, bool canClose = true)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            var document = _documents.TryGetValue(content.Key);

            if (document == null)
            {
                content.Changed += OnBaseStudioControlChanged;

                document                 = DockingManager.DockController.AddDocumentPanel(_documentGroup);
                document.Name            = "_" + content.Key.Replace("-", "_");
                document.Content         = content;
                document.ShowCloseButton = canClose;

                document.SetBindings(BaseLayoutItem.CaptionProperty, content, "Title");

                _documents.Add(content.Key, document);
                _controls.Add(content);

                OnBaseStudioControlChanged(content);
            }

            DockingManager.ActiveLayoutItem = document;
        }
Exemplo n.º 3
0
        public void OpenToolWindow(BaseStudioControl content, bool canClose = true)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            var anchorable = _anchorables.TryGetValue(content.Key);

            if (anchorable == null)
            {
                content.Changed += OnBaseStudioControlChanged;

                anchorable = new LayoutAnchorable
                {
                    ContentId = content.Key,
                    Content   = content,
                    CanClose  = canClose
                };

                anchorable.SetBindings(LayoutContent.TitleProperty, content, "Title");

                _anchorables.Add(content.Key, anchorable);

                RootGroup.Children.Add(new LayoutAnchorablePane(anchorable));
                OnBaseStudioControlChanged(content);
            }

            DockingManager.ActiveContent = anchorable.Content;
        }
Exemplo n.º 4
0
        public void CloseDocumentWindow(BaseStudioControl content)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            var document = _documents.TryGetValue(content.Key);

            if (document == null)
            {
                return;
            }

            DockingManager.DockController.Close(document);
        }
Exemplo n.º 5
0
        //private void OnDockingManagerLayoutChanged(object sender, EventArgs e)
        //{
        //	//if (DockingManager.Layout == null)
        //	//	return;

        //	//DockingManager.Layout.Updated += OnLayoutUpdated;
        //}

        //private void OnLayoutUpdated(object sender, EventArgs e)
        //{
        //	_isLayoutChanged = true;
        //	Flush();
        //}

        //private void OnDockingManagerDocumentClosing(object sender, DocumentClosingEventArgs e)
        //{
        //	var control = e.Document.Content as BaseStudioControl;

        //	if (control == null)
        //		return;

        //	e.Cancel = !control.CanClose();
        //}

        //private void OnDockingManagerDocumentClosed(object sender, DocumentClosedEventArgs e)
        //{
        //	var control = e.Document.Content as BaseStudioControl;

        //	if (control == null)
        //		return;

        //	_documents.RemoveWhere(p => Equals(p.Value, e.Document));

        //	_isLayoutChanged = true;

        //	_changedControls.Remove(control);
        //	_dockingControlSettings.Remove(control);

        //	Flush();
        //}

        private void OnBaseStudioControlChanged(BaseStudioControl control)
        {
            _changedControls.Add(control);
            Flush();
        }