示例#1
0
        private void AddDocument(MyDoc docType)
        {
            if (SearchDocument(docType.ToString(), dockManager.Layout) == null)
            {
                /*Get Corresponding  View*/
                string userString = EnumHelper.StringValueOf(docType, ReturnType.CLASS);
                Type   userClass  = Type.GetType(userString);

                /*Init VIew*/
                UserControl user =
                    Activator.CreateInstance(userClass) as UserControl;

                /*Add View*/
                LayoutDocument doc = new LayoutDocument();
                doc.Content   = user;
                doc.ContentId = docType.ToString();
                doc.Title     = EnumHelper.StringValueOf(docType);

                var firstDocumentPane = dockManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault();
                firstDocumentPane.Children.Add(doc);
            }

            var nowButton = SearchToggleButton(docType.ToString());

            if (nowButton != null)
            {
                nowButton.IsChecked = true;
            }
        }
示例#2
0
        private void CloseDocument(MyDoc docType)
        {
            var searched = SearchDocument(docType.ToString(), dockManager.Layout);

            if (searched != null)
            {
                searched.Close();
            }
        }