コード例 #1
0
ファイル: Page4.xaml.cs プロジェクト: Timthreetwelve/TimVer
 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);
         }
     }
 }
コード例 #2
0
ファイル: Page4.xaml.cs プロジェクト: Timthreetwelve/TimVer
 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);
         }
     }
 }
コード例 #3
0
ファイル: Page4.xaml.cs プロジェクト: Timthreetwelve/TimVer
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     tbHistOnStart.IsChecked = RegRun.RegRunEntry("TimVer");
 }