// Add a new VPN connection action. private void btnConnectVPN_Click(object sender, EventArgs e) { var sis = new SingleItemSelectorForm(); sis.SetText("Connect to VPN", "VPN Name:"); // Populate the combo box drop-down with the list of known VPNs. var rpbk = new RasPhoneBook(); rpbk.Open(RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.AllUsers)); foreach (var rent in rpbk.Entries) { sis.comboBox1.Items.Add(rent.Name); } rpbk.Open(RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.User)); foreach (var rent in rpbk.Entries) { sis.comboBox1.Items.Add(rent.Name); } if (sis.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var pcv = new PAConnectVPN(); pcv.VPN_Name = sis.comboBox1.Text; listBox1.Items.Add(pcv); } }
// Add a new default printer action. private void btnSetPrinter_Click(object sender, EventArgs e) { var sis = new SingleItemSelectorForm(); sis.SetText("Set Default Printer", "Printer:"); // Populate the combo box drop-down with the list of installed printers. foreach (string s in System.Drawing.Printing.PrinterSettings.InstalledPrinters) { sis.comboBox1.Items.Add(s); } if (sis.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var pdp = new PADefaultPrinter(); pdp.PrinterName = sis.comboBox1.Text; listBox1.Items.Add(pdp); } }