コード例 #1
0
ファイル: ProjectInfo.cs プロジェクト: 00Green27/DocUI
 public void fileOpened(string path, ProjectLayoutDocument doc)
 {
     if (!IsOpen(path))
     {
         _openfiles.Add(path, doc);
     }
 }
コード例 #2
0
ファイル: ProjectManager.cs プロジェクト: 00Green27/DocUI
        public void ShowPreferences(ProjectInfo pi)
        {
            if (!pi.IsOpen(pi.ProjectFile.FullName))
            {
                // create new tab and add it to the documentContainer
                ProjectLayoutDocument layout = new ProjectLayoutDocument(pi, pi.ProjectFile, null);

                bool ok;
                if (IsFileEmpty(pi.ProjectFile))
                {
                    ok = XmlValidator.Validate(pi.ProjectFile, XmlSchemaUtilities.getXmlSchemaFromXml(pi.ProjectFile.FullName));
                }
                else
                {
                    ok = true;
                }
                if (ok)
                {
                    ScrollViewer scroller = new ScrollViewer();
                    scroller.Content = FormFactory.GetNewForm(pi.ProjectFile, pi);
                    layout.Content = scroller;
                }
                else
                {
                    string messageBoxText = "File invalid, see log files for more info.";
                    string caption = "Filedrops";
                    MessageBoxButton button = MessageBoxButton.OK;
                    MessageBoxImage icon = MessageBoxImage.Warning;
                    MessageBox.Show(messageBoxText, caption, button, icon);
                }

                if (layout.Content != null)
                {
                    layout.IsActive = true;															 // focus on tab
                    DocPane.Children.Add(layout);									 // add to documentContainer
                    pi.fileOpened(pi.ProjectFile.FullName, layout);
                }
            }
            else
            {
                pi.SetFocus(pi.ProjectFile.FullName);
            }
        }