private async void TbHistOnStart_CheckedAsync(object sender, RoutedEventArgs e) { if (IsLoaded && !RegRun.RegRunEntry("TimVer")) { string result = RegRun.AddRegEntry("TimVer", AppInfo.AppPath + " /hide"); if (result == "OK") { log.Info(@"TimVer added to HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); OkDialog ok = new(); ok.Message = "TimVer was added to Windows startup"; _ = await DialogHost.Show(ok, "dh1").ConfigureAwait(true); } else { log.Info($"TimVer add to startup failed: {result}"); ErrorDialog ed = new(); ed.Message = "Failed to add TimVer to Windows startup.\n\nSee log file for additional info."; _ = await DialogHost.Show(ed, "dh1").ConfigureAwait(true); } } }
private async void TbHistOnStart_Unchecked(object sender, RoutedEventArgs e) { if (IsLoaded) { string result = RegRun.RemoveRegEntry("TimVer"); if (result == "OK") { log.Info(@"TimVer removed from HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); OkDialog ok = new(); ok.Message = "TimVer was removed from Windows startup"; _ = await DialogHost.Show(ok, "dh1").ConfigureAwait(true); } else { log.Info($"Attempt to remove startup entry failed: {result}"); ErrorDialog ed = new(); ed.Message = "Failed to remove TimVer from Windows startup.\n\nSee log file for additional info."; _ = await DialogHost.Show(ed, "dh1").ConfigureAwait(true); } } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { tbHistOnStart.IsChecked = RegRun.RegRunEntry("TimVer"); }