Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtBxUrl.Text == "")
            {
                return;
            }
            form_Inputbox InputBox = new form_Inputbox();

            if (InputBox.ShowDialog() == DialogResult.OK)
            {
                XmlDocument doc = new XmlDocument();
                if (!File.Exists(saveDirectory))
                {
                    XmlNode myRoot;
                    myRoot = doc.CreateElement("LinkList");
                    doc.AppendChild(myRoot);
                    doc.Save(@Path.GetTempPath() + "/LinkList.xml");
                }

                doc.Load(saveDirectory);
                XmlNode    root = doc.DocumentElement;
                XmlElement Link = doc.CreateElement("Link");

                XmlElement name = doc.CreateElement("Name");
                name.InnerText = InputBox.getName;
                XmlElement type1 = doc.CreateElement("Type");
                type1.InnerText = type.ToString();
                XmlElement url = doc.CreateElement("Url");
                url.InnerText = txtBxUrl.Text;

                Link.AppendChild(name);
                Link.AppendChild(type1);
                Link.AppendChild(url);
                root.AppendChild(Link);
                doc.Save(saveDirectory);
            }
            LoadListsToCombobox();
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtBxUrl.Text == "")
            {
                return;
            }
            form_Inputbox InputBox = new form_Inputbox();
            if (InputBox.ShowDialog() == DialogResult.OK)
            {
                XmlDocument doc = new XmlDocument();
                if (!File.Exists(saveDirectory))
                {
                    XmlNode myRoot;
                    myRoot = doc.CreateElement("LinkList");
                    doc.AppendChild(myRoot);
                    doc.Save(@Path.GetTempPath() + "/LinkList.xml");
                }

                doc.Load(saveDirectory);
                XmlNode root = doc.DocumentElement;
                XmlElement Link = doc.CreateElement("Link");

                XmlElement name = doc.CreateElement("Name");
                name.InnerText = InputBox.getName;
                XmlElement type1 = doc.CreateElement("Type");
                type1.InnerText = type.ToString();
                XmlElement url = doc.CreateElement("Url");
                url.InnerText = txtBxUrl.Text;

                Link.AppendChild(name);
                Link.AppendChild(type1);
                Link.AppendChild(url);
                root.AppendChild(Link);
                doc.Save(saveDirectory);
            }
        }