Пример #1
0
        internal static void CommandMenuInit()
        {
            try
            {
                Logger.Info(string.Format("Initializing iTimeTrack v{0}", WakaTimeConstants.PluginVersion));

                _settingsForm              = new SettingsForm();
                _settingsForm.ConfigSaved += SettingsFormOnConfigSaved;
                _wakaTimeConfigFile        = new WakaTimeConfigFile();
                var sbIniFilePath = new StringBuilder(Win32.MAX_PATH);
                Win32.SendMessage(PluginBase.NppData._nppHandle, NppMsg.NPPM_GETPLUGINSCONFIGDIR, Win32.MAX_PATH, sbIniFilePath);
                GetSettings();

                Task.Run(() => { InitializeWakaTimeAsync(); });

                // add menu item
                PluginBase.SetCommand(0, "iTimeTrack Settings", SettingsPopup, new ShortcutKey(false, false, false, Keys.None));
                _idMyDlg = 0;

                // prompt for api key if not already set
                if (string.IsNullOrEmpty(ApiKey))
                {
                    PromptApiKey();
                }

                Logger.Info(string.Format("Finished initializing iTimeTrack v{0}", WakaTimeConstants.PluginVersion));
            }
            catch (Exception ex)
            {
                Logger.Error("Error initializing iTimeTrack", ex);
            }
        }
Пример #2
0
        internal static void CommandMenuInit()
        {
            // must add menu item in foreground thread
            PluginBase.SetCommand(0, "Wakatime Settings", SettingsPopup, new ShortcutKey(false, false, false, Keys.None));
            idMyDlg = 0;

            // finish initializing in background thread
            Task.Run(() => {
                InitializeAsync();
            });
        }