/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// 扩展初始化加载 /// </summary> protected override void Initialize() { //按钮事件加载 GetTKKCommand.Initialize(this); TranslateCommand.Initialize(this); ToggleAutoTranslateCommand.Initialize(this); base.Initialize(); //加载配置项 Settings.ReloadSetting((OptionPageGrid)GetDialogPage(typeof(OptionPageGrid))); //创建连接返回翻译内容 if (Settings.RequestMode == RequestMode.Api) { TranslateClient = new TranslateClient(Settings);//new TranslateClient(Settings); } else { TranslateClient = new HtmlAnalysisTranslateClient(Settings); } DTE = (DTE2)GetService(typeof(DTE)); Events = DTE.Events; DocumentEvents = Events.DocumentEvents; WindowEvents = Events.WindowEvents; DocumentEvents.DocumentOpened += DocumentEvents_DocumentOpened; DocumentEvents.DocumentSaved += DocumentEvents_DocumentSaved; WindowEvents.WindowActivated += WindowEvents_WindowActivated; }
public static void Initialize(Package package) { Instance = new GetTKKCommand(package); }