コード例 #1
0
        private void AboutForm_Load(object sender, EventArgs e)
        {
            var version = new Version(Assembly.GetExecutingAssembly().GetCustomAttribute <AssemblyFileVersionAttribute>().Version);
            var title   = Assembly.GetExecutingAssembly().GetCustomAttribute <AssemblyTitleAttribute>().Title;

            versionLabel.Text = $"v{version.ToString(3)}";
            titleLabel.Text   = title;

            runOnStartupCheckBox.Checked = StartupHelper.IsRegisteredToRunAtStartup();

            GoogleAnalyticsHelper.TrackPage("AboutForm");
        }
コード例 #2
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();
     }
 }
コード例 #3
0
 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());
     }
 }