private void btnAdd_Click(object sender, EventArgs e) { string name = txtName.Text.Trim(); if (RegistryManager.GetRegistryKeys(_key).Any(item => item.Name == name)) { MessageBox.Show("این نام استفاده شده است.", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (name.Length == 0) { MessageBox.Show("لطفا مقادیر را وارد نمایید", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } RegistryManager.CreateKey(_key, name); MessageBox.Show("کلید افزوده شد.", "افزودن کلید", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; }
private void chkContextMenuMoveTo_CheckedChanged(object sender, EventArgs e) { string parent = @"HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers"; if (chkContextMenuMoveTo.Checked) { RegistryKey key = RegistryManager.CreateKey(parent, "MoveTo"); RegistryManager.EditValue(key.Name, "", new RegistryValue() { Name = "", Value = "{C2FBB631-2971-11D1-A18C-00C04FD75D13}", ValueKind = RegistryValueKind.String }); } else { RegistryManager.DeleteKey(parent, "MoveTo"); } }
private void chkDisableLockScreen_CheckedChanged(object sender, EventArgs e) { string parent = @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows"; if (chkDisableLockScreen.Checked) { RegistryManager.CreateKey(parent, "Personalization"); RegistryManager.AddValue($"{parent}\\Personalization", new RegistryValue { Name = "NoLockScreen", Value = 1, ValueKind = RegistryValueKind.DWord }); } else { RegistryManager.DeleteKey(parent, "Personalization"); } }
private void chkRestrictChangingDesktopWallpaper_CheckedChanged(object sender, EventArgs e) { string parentKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies"; if (chkRestrictChangingDesktopWallpaper.Checked) { RegistryKey key = RegistryManager.CreateKey(parentKey, "System"); string lastWallpaper = RegistryManager.GetKeyValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "WallPaper").Value.ToString(); RegistryManager.AddValue(key.Name, new RegistryValue() { Name = "WallPaper", Value = lastWallpaper, ValueKind = RegistryValueKind.String }); } else { RegistryManager.DeleteKey(parentKey, "System"); } }