static public void ResetKey(ref ContextMenuKey key) { try { key.Reset(); } catch (Exception ex) { ThisProgram.ThrowException(ex); } }
static public void DeleteKey(ContextMenuKey key) { try { StoredContextMenuKey.ToStore(key, ThisProgram.Path_RemoveKeys, true); } catch (Exception ex) { ThisProgram.ThrowException(ex); } }
public ViewModel() { model = new ContextMenu.Main.Model(); ThisProgram.ProgramException += (Exception ex) => { CustomExceptionHandler customExceptionHandler = new CustomExceptionHandler(ex); customExceptionHandler.ShowDialog(); }; ThisProgram.IsExistsEnvironment(); }
static public ContextMenuKey RestoreKey(StoredContextMenuKey key) { try { return(key.FromStore()); } catch (Exception ex) { ThisProgram.ThrowException(ex); return(null); } }
public void OpenRegedit(ContextMenuKey key) { RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software", true).OpenSubKey("Microsoft", true).OpenSubKey("Windows", true).OpenSubKey("CurrentVersion", true).OpenSubKey("Applets", true).OpenSubKey("Regedit", true); if (registryKey == null) { ThisProgram.ThrowException(new MyProgramException(@"Не удалось получить ключ 'HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Applets\Regedit'", TypeException.NotFatal)); } else { registryKey.SetValue("LastKey", key.FullNameRegistryKey); Process.Start("regedit.exe"); } } //открывает окно реестра
/// <summary> /// builds a space separated string from all arguments and Echos it. Expands enumerable types, except for string. /// </summary> /// <param name="things">params object array of what you want to echo. objects should have a ToString() method</param> public void Echo(params object[] things) { ThisProgram.Echo(ListToString(things: things)); }