private static void InitializeAsync() { try { Logger.Info(string.Format("Initializing WakaTime v{0}", Constants.PluginVersion)); // Settings Form _settingsForm = new WakaTime.Forms.SettingsForm(); _settingsForm.ConfigSaved += SettingsFormOnConfigSaved; // Load config file _wakaTimeConfigFile = new ConfigFile(); GetSettings(); // Prompt for api key if not already set if (string.IsNullOrEmpty(ApiKey)) { PromptApiKey(); } try { // Make sure python is installed if (!Dependencies.IsPythonInstalled()) { Dependencies.DownloadAndInstallPython(); } if (!Dependencies.DoesCliExist() || !Dependencies.IsCliUpToDate()) { Dependencies.DownloadAndInstallCli(); } } catch (WebException ex) { Logger.Error("Are you behind a proxy? Try setting a proxy in WakaTime Settings with format https://user:pass@host:port. Exception Traceback:", ex); } catch (Exception ex) { Logger.Error("Error detecting dependencies. Exception Traceback:", ex); } // setup timer to process queued heartbeats every 8 seconds timer.Interval = 1000 * 8; timer.Elapsed += ProcessHeartbeats; timer.Start(); Logger.Info(string.Format("Finished initializing WakaTime v{0}", Constants.PluginVersion)); } catch (Exception ex) { Logger.Error("Error Initializing WakaTime", ex); } }
private static void InitAsync() { try { Logger.logLevel = config.logLevel; WakaTimeConstants.EditorVersion = formatPLSQLDeveloperVersion(); // Make sure python is installed if (!Dependencies.IsPythonInstalled()) { Dependencies.DownloadAndInstallPython(); } if (!Dependencies.DoesCliExist() || !Dependencies.IsCliUpToDate()) { Dependencies.DownloadAndInstallCli(); } WakaTimeCliAvailable = true; heartbeatsTimer.Interval = 1000 * 8; heartbeatsTimer.Elapsed += ProcessHeartbeats; heartbeatsTimer.Start(); //lineTrackerTimer.Interval = 1000 * 10; //lineTrackerTimer.Elapsed += TrackCurrentEditorLine; //lineTrackerTimer.Start(); } catch (WebException ex) { Logger.Error("Are you behind a proxy? Try setting a proxy in WakaTime Settings with format https://user:pass@host:port. Exception Traceback:", ex); } catch (Exception ex) { Logger.Error("Error detecting dependencies. Exception Traceback:", ex); } }
private void InitializeAsync() { try { Logger.Info($"Initializing WakaTime v{Constants.PluginVersion}"); // VisualStudio Object _docEvents = ObjDte.Events.DocumentEvents; _windowEvents = ObjDte.Events.WindowEvents; _solutionEvents = ObjDte.Events.SolutionEvents; // Settings Form _settingsForm = new SettingsForm(); _settingsForm.ConfigSaved += SettingsFormOnConfigSaved; try { // Make sure python is installed if (!Dependencies.IsPythonInstalled()) { Dependencies.DownloadAndInstallPython(); } if (!Dependencies.DoesCliExist() || !Dependencies.IsCliUpToDate()) { Dependencies.DownloadAndInstallCli(); } } catch (WebException ex) { Logger.Error("Are you behind a proxy? Try setting a proxy in WakaTime Settings with format https://user:pass@host:port. Exception Traceback:", ex); } catch (Exception ex) { Logger.Error("Error detecting dependencies. Exception Traceback:", ex); } // Add our command handlers for menu (commands must exist in the .vsct file) if (GetService(typeof(IMenuCommandService)) is OleMenuCommandService mcs) { // Create the command for the menu item. var menuCommandId = new CommandID(GuidList.GuidWakaTimeCmdSet, (int)PkgCmdIdList.UpdateWakaTimeSettings); var menuItem = new MenuCommand(MenuItemCallback, menuCommandId); mcs.AddCommand(menuItem); } // setup event handlers _docEvents.DocumentOpened += DocEventsOnDocumentOpened; _docEvents.DocumentSaved += DocEventsOnDocumentSaved; _windowEvents.WindowActivated += WindowEventsOnWindowActivated; _solutionEvents.Opened += SolutionEventsOnOpened; // setup timer to process queued heartbeats every 8 seconds Timer.Interval = 1000 * 8; Timer.Elapsed += ProcessHeartbeats; Timer.Start(); Logger.Info($"Finished initializing WakaTime v{Constants.PluginVersion}"); } catch (Exception ex) { Logger.Error("Error Initializing WakaTime", ex); } }