static void Main() { if (!mutex.WaitOne(TimeSpan.FromSeconds(1), false)) { Debug.WriteLine("Already running. This instance will exit."); return; } try { SquirrelHelper.ProcessSquirrelEvents(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new DockForm()); } finally { mutex.ReleaseMutex(); } }
private void DockForm_Load(object sender, EventArgs e) { keyboardStateCheckTimer.Enabled = true; notifyIcon.Visible = true; var windowsVersion = Environment.OSVersion.Version; if (windowsVersion < Version.Parse("10.0.16299.0")) { GoogleAnalyticsHelper.TrackEvent("InstalledOnUnsupportedOS", windowsVersion.ToString()); MessageBox.Show("Touch Keyboard Focus Fix only works on Windows 10 v1709 (Fall Creators Update) and above.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); ExitProgram(); } SquirrelHelper.CheckForUpdates(); var appVersion = new Version(Assembly.GetExecutingAssembly().GetCustomAttribute <AssemblyFileVersionAttribute>().Version); GoogleAnalyticsHelper.TrackPage("DockForm"); GoogleAnalyticsHelper.TrackEvent("OSVersion", windowsVersion.ToString()); GoogleAnalyticsHelper.TrackEvent("AppStarted", appVersion.ToString()); GoogleAnalyticsHelper.TrackEvent("UsageMode", TabletModeHelper.IsTabletMode ? "Tablet" : "Desktop"); }