Example #1
0
        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);
            }
        }