private void BtnCopy_Click(object sender, EventArgs e) { OpenFormName = EntryFormName; CopyEntryFormName = EntryFormName.Trim() + " (Copy)"; btnDelete.Enabled = false; foreach (NewSeviceEntry nse in NewSvcEnty) { if (nse.NewSeviceEntryName == CopyEntryFormName) { MessageBox.Show(CopyEntryFormName + " already exists! - please rename service entry called " + CopyEntryFormName); return; } } var res = (from p in NewSvcEnty where p.NewSeviceEntryName == EntryFormName select p).ToList(); List <NewSeviceEntry> ns = res; AddEntriesToMainForm(null, true); newform = new NewEntry(this, ""); newform.SaveImportToXMLSettings(ns, true); string xmlfile = Environment.CurrentDirectory + "\\settings2.xml"; NewSvcEnty.AddNewEntry(XDocument.Load(xmlfile)); CopyEntryFormName = ""; UpdateColor(); UpdateCopyColor(NewSvcEnty); EntryFormName = ""; OpenFormName = ""; btnCopy.Enabled = false; }
internal void AddNewEntryForm(string str, XDocument xdoc) { Label newEntryButton = new Label(); newEntryButton.DoubleClick += NewEntryButton_DoubleClick; newEntryButton.Click += NewEntryButton_Click; newEntryButton.BackColor = Color.Gray; newEntryButton.Height = 50; newEntryButton.Width = 710; newEntryButton.TextAlign = ContentAlignment.MiddleCenter; FontFamily family = new FontFamily("Arial"); newEntryButton.Font = new Font(family, 10.0f, FontStyle.Bold); newEntryButton.BorderStyle = BorderStyle.FixedSingle; newEntryButton.Name = str; newEntryButton.Text = str; flpEntryForm.FlowDirection = FlowDirection.TopDown; flpEntryForm.WrapContents = false; flpEntryForm.AutoScroll = true; flpEntryForm.Controls.Add(newEntryButton); NewSvcEnty.AddNewEntry(xdoc); }
public void DeleteServiceEntry(XDocument xdoc) { NewSvcEnty.AddNewEntry(xdoc); }