Exemplo n.º 1
0
        private void btAddSnippet_Click(object sender, EventArgs e)
        {
            string eventname = "";

            if (cBoxEvents.SelectedItem.ToString() != "Choose a Method...")
            {
                eventname = cBoxEvents.SelectedItem.ToString().Trim();

                if (tbSnippetCode.Text != "")
                {
                    //Read the TextBox
                    //Add....
                    StringBuilder sb = new StringBuilder();
                    sb = LSLSnippet.AddSnippet(tbXMLFile.Text, eventname, tbSnippetCode.Text);

                    //Now update tbXMLFile.Text
                    tbXMLFile.Clear();
                    tbXMLFile.AppendText(sb.ToString());

                    //Clear Textbox
                    tbSnippetCode.Text = "";
                }
                else
                {
                    MessageBox.Show("No code for event.", "AddSnippet", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("No Event choosen.", "AddSnippet", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Open a tabPageXML
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void createXMLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tabControl1.Visible == false)
            {
                tabControl1.Visible = true;
                tabControl1.TabPages[0].Dispose();
                tabControl1.SelectedTab = tabControl1.TabPages["tabPageXML"];
                //This new tab may be closed now
                closeTabToolStripMenuItem.Enabled = true;
                toolStripCloseTab.Enabled         = true;
            }
            else
            {
                //Tabs are already open, is tabPageXML already open?
                if (!IstabPageXMLOpen())
                {
                    //tabControl1.TabPages.Insert(tabControl1.TabPages.Count, "tabPageXML");
                    tabControl1.TabPages.Add(tabPageXML);
                    tabControl1.SelectedTab = tabControl1.TabPages[tabControl1.TabPages.Count - 1];
                }
                else
                {
                    //Already open, just select it
                    tabControl1.SelectedTab = tabControl1.TabPages["tabPageXML"];
                }
            }

            //Populate the textbox
            tbXMLFile.Clear();
            tbXMLFile.Text = LSLSnippet.Getblankxml().ToString();

            //Choose first cBoxEvents item
            cBoxEvents.SelectedIndex = 0;
        }
Exemplo n.º 3
0
        public Form1(params object[] args)
        {
            InitializeComponent();

            if (args.Length > 1)
            {
                m_FilePath    = args[0].ToString();
                m_RichTextBox = args[1] as RichTextBox;
            }
            else
            {
                m_FilePath    = "";
                m_RichTextBox = new RichTextBox();
            }

            //Set cBoxEvents
            cBoxEvents.SelectedIndex = 0;

            //Populate the textbox
            tbXMLFile.Clear();
            tbXMLFile.Text = LSLSnippet.Getblankxml().ToString();

            //
            rboxLSLScript.Text = m_RichTextBox.SelectedText;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Set the title of the xml snippet
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btSetTitle_Click(object sender, EventArgs e)
        {
            if (tbSnippetTitle.Text != "")
            {
                //Read the TextBox
                StringBuilder sb = new StringBuilder();
                sb.Append(tbXMLFile.Text);
                //Replace
                string titlevalue = LSLSnippet.GetTitlevalue(sb.ToString());
                sb.Replace(titlevalue, tbSnippetTitle.Text);

                //Now update tbXMLFile.Text
                tbXMLFile.Clear();
                tbXMLFile.AppendText(sb.ToString());

                //Clear Textbox
                tbSnippetTitle.Text = "";
            }
            else
            {
                MessageBox.Show("No title text to set.", "SetTitle", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Insert a snippet that was choosen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripcBoxSnippets_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (toolStripcBoxSnippets.Enabled)
            {
                //Load the selected Snippet...
                //Take in the current lslscript
                lslSnippetsLib.LSLSnippet Snippet = new LSLSnippet(tabControl1.SelectedTab.Controls[0].Text);
                //Load the selected snippet's xml
                Snippet.xmlDoc.Load(Common.snippetsFolder + "//" + toolStripcBoxSnippets.SelectedItem.ToString());

                //Do the insert of the snippet
                string newlslscript;
                Snippet.DoInsert(out newlslscript);

                //Update the TextBox...
                tabControl1.SelectedTab.Controls[0].Text = newlslscript;

                //Select all of the text in textbox
                tabControl1.SelectedTab.Controls[0].Focus();

                //Exit the dropdownlist
                toolStripcBoxSnippets.PerformClick();
            }
        }