Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
        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) { }
                }
            }
        }