Esempio n. 1
0
        private void OnCreateNewDocumentContent(object sender, RoutedEventArgs e)
        {
            string title = "MainWindow.xml.cs";

            DocumentContent[] cnts = this.DockManager.Documents.ToArray();
            int i = 1;

            while (cnts.FirstOrDefault(c => c.Title == title) != null)
            {
                title = string.Format("NewDocument{0}", i);
                i++;
            }

            var newContent = new DocumentContent()
            {
                Title = title, Content = new TextBox()
            };

            newContent.Icon = new BitmapImage(new Uri(@"Images\database.png", UriKind.Relative));
            newContent.ContentTypeDescription = "Base Description of " + title;
            newContent.InfoTip            = System.IO.Path.GetTempPath();
            newContent.FloatingWindowSize = new Size(500.0, 500.0);
            newContent.Show(DockManager, true);
            newContent.Activate();
        }
Esempio n. 2
0
        /// <summary>
        ///   Adds a UserControl to the main component container
        /// </summary>
        /// <param name = "control">UserControl element</param>
        /// <param name = "controlTabTitle">The title to give the tab element</param>
        public void AddMainComponent(UserControl control, string controlTabTitle)
        {
            try
            {
                Framework.EventBus.Publish(new PanelEvent(this));

                var             alreadyOpen = false;
                DocumentContent focusThis   = null;

                foreach (DocumentContent cCtrl in this.MainComponentContainer.Items)
                {
                    if (cCtrl.Tag.ToString().CompareTo(controlTabTitle) == 0)
                    {
                        alreadyOpen = true;
                        focusThis   = cCtrl;
                    }
                }

                if (alreadyOpen == false)
                {
                    var title = controlTabTitle;

                    if (controlTabTitle.Contains("\\"))
                    {
                        var parts = controlTabTitle.Split('\\');
                        title = parts[parts.Length - 1];
                    }

                    var newContentControl = new ContentControl
                    {
                        Margin = new Thickness(0), Content = control
                    };
                    var newDocumentContent = new DocumentContent
                    {
                        Title = title, Background = Brushes.White, Content = newContentControl, Icon = Framework.Images.GetImage("CutHS", "VS2010ImageLibrary", 12).Source, Tag = controlTabTitle
                    };
                    newDocumentContent.Closing += this.NewDocumentContentClosing;

                    this.MainComponentContainer.Items.Add(newDocumentContent);
                    newDocumentContent.Show(this.dockManager);
                    newDocumentContent.Activate();
                }
                else
                {
                    focusThis.Show(this.dockManager);
                    focusThis.Activate();

                    var newWindow = ( IUserControl )control;
                    newWindow.Dispose();
                }

                control.Focus();
                control.BringIntoView();
            }
            catch (Exception error)
            {
                Framework.EventBus.Publish(error);
            }
        }
Esempio n. 3
0
        private void ExportLayoutToDocument(object sender, RoutedEventArgs e)
        {
            DocumentContent doc = new DocumentContent()
            {
                Title   = string.Format("Layout_{0}", DateTime.Now.ToString()),
                Content = new TextBox()
                {
                    AcceptsReturn = true,
                    VerticalScrollBarVisibility   = ScrollBarVisibility.Auto,
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                    Text = DockManager.LayoutToString()
                }
            };

            doc.Show(DockManager);
            doc.Activate();
        }
Esempio n. 4
0
        /// <summary>
        /// Adds the view.
        /// </summary>
        /// <typeparam name="TView">The type of the view.</typeparam>
        /// <param name="view">The view.</param>
        /// <param name="regionName">Name of the region.</param>
        /// <param name="title">The title.</param>
        /// <returns></returns>
        public IRegionAdapter AddView <TView>(TView view, string regionName, string title = "") where TView : class
        {
            object region = regions[regionName];

            if (region is ContentControl)
            {
                ((ContentControl)region).Content = view;
            }
            if (region is DocumentPane)
            {
                var panel = new DocumentContent {
                    Title = typeof(TView).Name, Content = view
                };
                panel.Title = title;
                ((DocumentPane)region).Items.Add(panel);
                panel.Activate();
            }
            return(this);
        }
        private void ExportLayoutToDocument(object sender, RoutedEventArgs e)
        {
            DocumentContent doc = new DocumentContent()
            {
                Title = string.Format("Layout_{0}", DateTime.Now.ToString()),
                Content = new TextBox()
                {
                    AcceptsReturn = true,
                    VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                    Text = DockManager.LayoutToString()
                }
            };

            doc.Show(DockManager);
            doc.Activate();
        }
        private void OnCreateNewDocumentContent(object sender, RoutedEventArgs e)
        {
            string title = "MainWindow.xml.cs";
            DocumentContent[] cnts = this.DockManager.Documents.ToArray();
            int i = 1;
            while (cnts.FirstOrDefault(c => c.Title == title) != null)
            {
                title = string.Format("NewDocument{0}", i);
                i++;
            }

            var newContent = new DocumentContent() { Title = title, Content = new TextBox() };
            newContent.Icon = new BitmapImage(new Uri(@"Images\database.png", UriKind.Relative));
            newContent.ContentTypeDescription = "Base Description of " + title;
            newContent.InfoTip = System.IO.Path.GetTempPath();
            newContent.FloatingWindowSize = new Size(500.0, 500.0);
            newContent.Show(DockManager, true);
            newContent.Activate();
        }
 public void ShowDockPanel(DocumentContent doc)
 {
     doc.Show(DockManager);
     doc.Activate();
 }