public Main() { InitializeComponent(); var userGuid = System.Guid.NewGuid().ToString("B").ToUpper(); Analytics.Initialize("pzNi0MJVC1P9tVZdnvDOyptvUwPov9BN", new Config().SetAsync(false)); Analytics.Client.Track(userGuid, "Started App", new Segment.Model.Properties() { // { "datetime", DateTime.Now }, { "dimension1", OSVersionInfo.Name + " " + OSVersionInfo.Edition + " " + OSVersionInfo.ServicePack } }); lblVersion.Text = "v" + Application.ProductVersion; var latestVersion = VersionController.GetRemoteLatestVersion(); if (Version.Parse(latestVersion) > Version.Parse(Application.ProductVersion)) { tileGetNewVersion.Visible = true; } Start control = new Start(); control.Dock = DockStyle.Fill; Controls.Add(control); }
/// <summary> /// Initializes a new instance of the <see cref="Main"/> class. /// </summary> /// <param name="loggingLevelSwitch">An object that can be used to dynamically change the logging level at runtime.</param> public Main(LoggingLevelSwitch loggingLevelSwitch) { this.InitializeComponent(); if (Properties.Settings.Default.UpdateSettings) { Log.Logger.Information("Updating user settings per new release."); Log.Logger.Debug("OLD user settings: {@settings}", Properties.Settings.Default); Properties.Settings.Default.Upgrade(); Properties.Settings.Default.UpdateSettings = false; Properties.Settings.Default.Save(); Log.Logger.Debug("NEW user settings: {@settings}", Properties.Settings.Default); } var osInfo = $"{OSVersionInfo.Name} {OSVersionInfo.Edition} {OSVersionInfo.ServicePack}"; var versionString = OSVersionInfo.VersionString; Log.Logger.Information("Operating System information: {osInfo} {versionString}", osInfo, versionString); if (Properties.Settings.Default.ShareStatistics) { var userGuid = Guid.NewGuid().ToString("B").ToUpper(CultureInfo.InvariantCulture); Analytics.Initialize("pzNi0MJVC1P9tVZdnvDOyptvUwPov9BN", new Config().SetAsync(false)); Analytics.Client.Track( userGuid, "Started App", new Segment.Model.Properties() { { "dimension1", osInfo }, }); } this.lblVersion.Text = "v" + Application.ProductVersion; try { var latestVersion = VersionController.GetRemoteLatestVersion(); if (Version.Parse(latestVersion) > Version.Parse(Application.ProductVersion)) { Log.Information("Version {version} is available.", latestVersion); this.tileGetNewVersion.Visible = true; } } catch (VersionControllerException ex) { DialogController.ShowMessage(ex.Source, ex.Message, SystemIcons.Error, DialogController.DialogButtons.OK); } Start control = new Start(loggingLevelSwitch); control.Dock = DockStyle.Fill; this.Controls.Add(control); }