コード例 #1
0
 public NewTemplateName(MainWindow caller, MainWindow mainWindow, TemplateXmlNode template)
 {
     InitializeComponent();
     mainWindowCaller      = caller;
     this.Topmost          = true;
     this.mainEditorWindow = mainWindow;
     this.newTemplate      = new TemplateXmlNode(template.XmlNode, "", new List <string> (template.TabHeaders), template.XmlNode.Name);
 }
コード例 #2
0
        public void UserEnteredNewMainNodeName(string mainNodeName)
        {
            List <string> blankTabHeaders = new List <string> ();

            blankTabHeaders.Add(mainNodeName);
            XmlDocument     helperXmlDoc              = new XmlDocument();
            XmlNode         blankXmlNode              = helperXmlDoc.CreateNode("element", mainNodeName, "");
            TemplateXmlNode blankTemplateXmlNode      = new TemplateXmlNode(blankXmlNode, "Blank Template", blankTabHeaders, mainNodeName);
            MainWindow      modifyBlankTemplateWindow = new MainWindow("", mainWindowCaller.GetAvailableTemplates(),
                                                                       isTemplateWindow: true, templateXmlNodeParam: blankTemplateXmlNode, caller: mainWindowCaller);

            modifyBlankTemplateWindow.Show();
            this.Close();
        }
コード例 #3
0
        private void TemplateSelectButton_Click(object sender, RoutedEventArgs e)
        {
            if (TemplatesListBox.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a template and try again.", "No template selected");
                return;
            }

            if (currentMode == Mode.Modify)
            {
                ListBoxItem     selectedItem    = TemplatesListBox.SelectedItem as ListBoxItem;
                string          name            = selectedItem.Content as string;
                TemplateXmlNode templateXmlNode = GetTemplateXmlNodeWithName(name);

                if (name.ToLower() == "create a new template")
                {
                    BlankTemplateUOPName mainNodeNameWindow = new BlankTemplateUOPName(this, mainWindowCaller);
                    mainNodeNameWindow.Show();
                    this.Close();
                }
                else
                {
                    MainWindow modifyTemplateWindow = new MainWindow("", mainWindowCaller.GetAvailableTemplates(),
                                                                     isTemplateWindow: true, templateXmlNodeParam: templateXmlNode, caller: mainWindowCaller);
                    modifyTemplateWindow.Show();
                    this.Close();
                }
            }
            else if (currentMode == Mode.Select)
            {
                ListBoxItem     selectedItem    = TemplatesListBox.SelectedItem as ListBoxItem;
                string          name            = selectedItem.Content as string;
                TemplateXmlNode templateXmlNode = GetTemplateXmlNodeWithName(name);
                mainWindowCaller.UserSelectedTemplate(templateXmlNode, pathID);
                mainWindowCaller.IsEnabled = true;
                this.Close();
            }
        }