private void RemoveHandler(object sender, EventArgs e) { ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender; Microsoft.Win32.RegistryKey WindowsBackupMon_key; WindowsBackupMon_key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("WindowsBackupMon"); WindowsBackupMon_key.DeleteValue(clickedItem.Text); refresh(); }
private void addServerToolStripMenuItem_Click(object sender, EventArgs e) { AddServer dlg = new AddServer(); if (dlg.ShowDialog() == DialogResult.OK) { Microsoft.Win32.RegistryKey WindowsBackupMon_key; WindowsBackupMon_key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("WindowsBackupMon"); String Servername = dlg.textBox_server.Text; String User = dlg.textBox_user.Text; String Pass = dlg.textBox_password.Text; Pass = Encrypt(Pass); WindowsBackupMon_key.SetValue(Servername, new string[] { User, Pass }, Microsoft.Win32.RegistryValueKind.MultiString); WindowsBackupMon_key.Close(); } }
void LoadServers() { Microsoft.Win32.RegistryKey WindowsBackupMon_key; WindowsBackupMon_key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("WindowsBackupMon"); if (WindowsBackupMon_key != null) { foreach (string name in WindowsBackupMon_key.GetValueNames()) { try { string[] values = (string[])WindowsBackupMon_key.GetValue(name); ServerInfo si = new ServerInfo(); si.Name = name; si.Password = Decrypt(values[1]); si.User = values[0]; MyServers.Add(si); } catch (Exception ex) { } } } }