Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            //btnDelete.BackColor = Color.Red;
            //btnDelete.ForeColor = Color.White;
            //MessageBox.Show(EntryFormName);
            if (!string.IsNullOrEmpty(EntryFormName))
            {
                DialogResult dialogResult = MessageBox.Show("Delete: " + EntryFormName, "Delete Service Entry", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    flpEntryForm.Controls.Remove(lab);

                    NewSvcEnty.DeleteEntry(EntryFormName);
                }
            }

            // lab.BackColor = Color.Gray;
            lab.BackColor = Color.LightGray;
            EntryFormName = "";

            btnCopy.Enabled         = false;
            btn_AddNewEntry.Enabled = true;
            btnDelete.Enabled       = false;
            //btnDelete.BackColor = Color.LightGray;
            //btnDelete.ForeColor = Color.LightGray;
            btnCancel.Enabled = false;

            // If there are no more entries/services then set
            // Service button to Stopped and disable it
            // and update xml file with status of Stopped
            if (NewSvcEntyInstance.Count == 0)
            {
                StopStart(Color.Red, "Stopped", false);
                btnStart.Enabled = false;
                NewSvcEntyNames.UpdateServiceButton("Stopped");
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public void DeleteServiceEntry(XDocument xdoc)
 {
     NewSvcEnty.AddNewEntry(xdoc);
 }