Example #1
0
 private void runOnStartupCheckBox_CheckedChanged(object sender, EventArgs e)
 {
     if (runOnStartupCheckBox.Checked)
     {
         GoogleAnalyticsHelper.TrackEvent("Settings", "Startup", "Enabled");
         StartupHelper.AddToStartup();
     }
     else
     {
         GoogleAnalyticsHelper.TrackEvent("Settings", "Startup", "Disabled");
         StartupHelper.RemoveFromStartup();
     }
 }
 internal static void ProcessSquirrelEvents()
 {
     try
     {
         using (var mgr = new UpdateManager(releasesPath))
         {
             // Note, in most of these scenarios, the app exits after this method
             // completes!
             SquirrelAwareApp.HandleEvents(
                 onInitialInstall: v =>
             {
                 mgr.CreateOnlyStartMenuShortcutForThisExe();
             },
                 onAppUpdate: v =>
             {
                 if (StartupHelper.IsRegisteredToRunAtStartup())
                 {
                     StartupHelper.AddToStartup();     // Fix executable path change
                 }
                 mgr.CreateOnlyStartMenuShortcutForThisExe();
             },
                 onAppUninstall: v =>
             {
                 StartupHelper.RemoveFromStartup();
                 mgr.RemoveOnlyStartMenuShortcutForThisExe();
             },
                 onFirstRun: () =>
             {
                 GoogleAnalyticsHelper.TrackPage("Installed");
                 StartupHelper.AddToStartup();
             });
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("ProcessSquirrelEvents failed: " + ex.ToString());
     }
 }