示例#1
0
        private void AddEntry(string value)
        {
            var entry = new EntryControl(value);

            entry.MouseClick += Entry_Click;
            panel1.Controls.Add(entry);
            panel2.SendToBack();
        }
示例#2
0
 private void Entry_Click(object sender, EventArgs e)
 {
     currentEntry = sender as EntryControl;
     if (folderBrowserDialog != default)
     {
         currentEntry.ContextMenuStrip = contextMenuStrip1;
     }
 }
        // ALL ENTRIES.
        private List <EntryContent> getEntries()
        {
            try
            {
                List <EntryControl> controlList = new List <EntryControl>();
                List <EntryContent> contentList = new List <EntryContent>();
                EntryControl        entry1      = new EntryControl(LABEL1, label1Box);
                controlList.Add(entry1);
                EntryControl entry2 = new EntryControl(LABEL2, label2Box);
                controlList.Add(entry2);
                EntryControl entry3 = new EntryControl(LABEL3, label3Box);
                controlList.Add(entry3);
                EntryControl entry4 = new EntryControl(LABEL4, label4Box);
                controlList.Add(entry4);
                EntryControl entry5 = new EntryControl(LABEL5, label5Box);
                controlList.Add(entry5);

                foreach (var control in controlList)
                {
                    if (control.textBox.Visible == true && control.textBox.Text == string.Empty)
                    {
                        // Return empty list
                        control.textBox.Focus();
                        contentList = new List <EntryContent>();
                        return(contentList);
                    }
                    else if (control.textBox.Visible == true && control.textBox.Text != string.Empty)
                    {
                        EntryContent sampleEntry = new EntryContent(control.label.Text, control.textBox.Text);
                        contentList.Add(sampleEntry);
                    }
                }
                return(contentList);
            }
            catch (Exception ex)
            {
                string msg = "Issue occured while retrieving entered entries. Contact system admin." +
                             System.Environment.NewLine + ex.Message;
                System.Windows.Forms.MessageBox.Show(msg, "Error 03");
                return(new List <EntryContent>());
            }
        }