private void CheckAllKeysMethod() { for (int i = ListOfRegKeys.Count; i > 0; i--) { RegistryListItem item = ListOfRegKeys[i - 1]; ListOfRegKeys.Remove(item); if (CheckAllKeysIsChecked) { item.IsChecked = true; } else { item.IsChecked = false; } ListOfRegKeys.Insert(i - 1, item); } }
private async void CleanMethod() { mainWindowViewModel.TabControlIsEnabled = false; ProgressBarIsIndeterminate = true; string toExecuteAsAdmin = null; string toExecuteAsUser = null; foreach (RegistryListItem item in ListOfRegKeys) { if (item.IsChecked) { string value = item.Value; if (value != null) { //if end of ValueName is "\" char if (value.LastIndexOf(@"\") == value.Length - 1) { value += @"\"; } } // if (item.DeleteFullKey) { if (item.ReqAdminToModify) { toExecuteAsAdmin += " -DeleteKey \"" + item.Key + "\""; } else { toExecuteAsUser += " -DeleteKey \"" + item.Key + "\""; } } else { if (item.ReqAdminToModify) { toExecuteAsAdmin += " -DeleteValue \"" + item.Key + "\" \"" + value + "\""; } else { toExecuteAsUser += " -DeleteValue \"" + item.Key + "\" \"" + value + "\""; } } } } if (toExecuteAsUser != null) { bool result = await StartRegCleaner(false, toExecuteAsUser); if (result) { for (int i = ListOfRegKeys.Count; i > 0; i--) { if ((ListOfRegKeys[i - 1].IsChecked) && (!ListOfRegKeys[i - 1].ReqAdminToModify)) { ListOfRegKeys.Remove(ListOfRegKeys[i - 1]); } } } } if (toExecuteAsAdmin != null) { bool result = await StartRegCleaner(true, toExecuteAsAdmin); if (result) { for (int i = ListOfRegKeys.Count; i > 0; i--) { if ((ListOfRegKeys[i - 1].IsChecked) && (ListOfRegKeys [i - 1].ReqAdminToModify)) { ListOfRegKeys.Remove(ListOfRegKeys[i - 1]); } } } } mainWindowViewModel.TabControlIsEnabled = true; ProgressBarIsIndeterminate = false; }