private void UrlCheckBox_Unchecked(object sender, RoutedEventArgs e) { string UrlName = (sender as CheckBox).Content.ToString(); WebModul.UrlModel url = wm.Urls.Where((u) => u.CatName.Equals(UrlName)).First(); urlList.Remove(url); }
private void cbCatagory_SelectionChanged(object sender, SelectionChangedEventArgs e) { WebModul.UrlModel urlmodel = (sender as ComboBox).SelectedItem as WebModul.UrlModel; if (urlmodel == null) { return; } }
private void txtCat_SelectionChanged(object sender, SelectionChangedEventArgs e) { WebModul.UrlModel um = (sender as ComboBox).SelectedItem as WebModul.UrlModel; if (um == null) { return; } txtCatName.Text = um.CatName; txtT1.Text = um.URLT1; txtT2.Text = um.URLT2; txtT3.Text = um.URLT3; selectUrl = um.CatName; }
private void btnNewUrl_Click(object sender, RoutedEventArgs e) { XmlDocument document = new XmlDocument(); document.Load(path); XmlNode urlsnode = document.SelectSingleNode("/WebInfo/Web[@Name='" + selectText + "']/URLs"); if (urlsnode == null) { return; } XmlElement node = document.CreateElement("URL"); node.SetAttribute("Catagory", txtCatName.Text); XmlElement subnode1 = document.CreateElement("t1"); subnode1.InnerText = txtT1.Text; XmlElement subnode2 = document.CreateElement("t2"); subnode2.InnerText = txtT2.Text; XmlElement subnode3 = document.CreateElement("t3"); subnode3.InnerText = txtT3.Text; node.AppendChild(subnode1); node.AppendChild(subnode2); node.AppendChild(subnode3); urlsnode.AppendChild(node); document.Save(path); WebModul.UrlModel urlmodel = new WebModul.UrlModel(txtCatName.Text, txtT1.Text, txtT2.Text, txtT3.Text); List <WebModul.UrlModel> list = new List <WebModul.UrlModel>(); list.Add(urlmodel); MessageBox.Show("New URL Added"); }
private void btnNew_Click(object sender, RoutedEventArgs e) { XmlDocument document = new XmlDocument(); document.Load(path); XmlElement root = document.DocumentElement; XmlElement webnode = document.CreateElement("Web"); webnode.SetAttribute("Name", txtNew.Text); webnode.SetAttribute("StartURL", tbStartUrl.Text); webnode.SetAttribute("Modul", "1"); XmlElement Urls = document.CreateElement("URLs"); XmlElement url = document.CreateElement("URL"); url.SetAttribute("Catagory", txtCatName.Text); XmlElement e1 = document.CreateElement("t1"); e1.InnerText = txtT1.Text; url.AppendChild(e1); XmlElement e2 = document.CreateElement("t2"); e2.InnerText = txtT2.Text; url.AppendChild(e2); XmlElement e3 = document.CreateElement("t3"); e3.InnerText = txtT3.Text; url.AppendChild(e3); Urls.AppendChild(url); webnode.AppendChild(Urls); XmlElement linknode = document.CreateElement("RegularLink"); linknode.InnerText = tbrLink.Text; webnode.AppendChild(linknode); XmlElement Introductionnode = document.CreateElement("RegularIntroduction"); Introductionnode.InnerText = tbrIntroduction.Text; webnode.AppendChild(Introductionnode); XmlElement titlenode = document.CreateElement("RegularTitel"); titlenode.InnerText = tbrTitel.Text; webnode.AppendChild(titlenode); XmlElement datenode = document.CreateElement("RegularDate"); datenode.InnerText = tbrDate.Text; webnode.AppendChild(datenode); XmlElement contentnode = document.CreateElement("RegularContent"); contentnode.InnerText = tbrContent.Text; webnode.AppendChild(contentnode); root.AppendChild(webnode); document.Save(path); WebModul.UrlModel urlmodel = new WebModul.UrlModel(txtCatName.Text, txtT1.Text, txtT2.Text, txtT3.Text); List <WebModul.UrlModel> list = new List <WebModul.UrlModel>(); list.Add(urlmodel); ModulList.Add(new WebModul(txtNew.Text, tbStartUrl.Text, list, "1", tbrLink.Text, tbrIntroduction.Text, tbrTitel.Text, tbrDate.Text, tbrContent.Text, txtMin.Text, txtMax.Text, txtStep.Text)); MessageBox.Show("New Added"); }