public void Execute(object data) { string text = (string)data; bool textIsEmail = isEmail(text); bool textIsURL = isURL(text); if (textIsEmail) { if ((addEmail) && (!entries.Contains(text))) { entries.Add(text); } if (bool.Parse(myOptions["CatchEmail"])) { try { Process.Start("mailto:" + text); } catch (Win32Exception w3e) { MessageBox.Show("Error opening the email client:\n" + w3e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (ObjectDisposedException ode) { MessageBox.Show("Error opening the email client:\n" + ode.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else if (textIsURL) { if ((addURL) && (!entries.Contains(text))) { entries.Add(text); } if (bool.Parse(myOptions["CatchUrl"])) { try { Process.Start(text); } catch (Win32Exception w3e) { MessageBox.Show("Error opening the browser:\n" + w3e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (ObjectDisposedException ode) { MessageBox.Show("Error opening the browser:\n" + ode.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else if ((!textIsEmail) && (!textIsURL)) { if (!entries.Contains(text)) { entries.Add(text); } } }
private void FillListBox() { entryListListBox.Items.Clear(); entriesNew = new EntryList(); entriesNew.MaxSize = maxSize; entryListListBox.BeginUpdate(); for (int i = 0; i < entries.Count; i++) { entryListListBox.Items.Add(entries[i]); entriesNew.Add(entries[i]); } entryListListBox.EndUpdate(); }
private void applyButton_Click(object sender, EventArgs e) { entries.Clear(); entries.MaxSize = maxSize; if (entriesNew.Count == 0) { Clipboard.Clear(); } else { for (int i = 0; i < entriesNew.Count; i++) { entries.Add(entriesNew[i]); } } applyButton.Enabled = false; }