/// <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 BingTranslator() { _translateClient = new TranslateClient(new CognitiveServicesConfig() { SubscriptionKey = ConfigurationManager.AppSettings["BingKey"], SubscriptionKeyAlternate = ConfigurationManager.AppSettings["BingAlternateKey"] }); }
public ServiceMetasController(ITenant tenant, ITranslateClient translateClient, ITokenRefresherWithServiceClient tokenRefresher, IVisualNotificationClient visualNotificationClient, ICustomerMasterClient customerMasterClient, IStatisticsClient StatisticsClient) { _tenant = tenant; _translateClient = translateClient; _tokenRefresher = tokenRefresher; _visualNotificationClient = visualNotificationClient; _customerMasterClient = customerMasterClient; _StatisticsClient = StatisticsClient; }
public AzureTranslator(IAzureTranslatorConfig config, ILogger <AzureTranslator> logger) { _logger = logger; _config = config; // https://github.com/Nordes/CognitiveServices.Translator.Client client = new TranslateClient(new CognitiveServicesConfig() { SubscriptionKey = _config.SubscriptionKey, }); }
public StatisticsController(IStatisticsClient StatisticsClient, ITranslateClient translateClient) { _StatisticsClient = StatisticsClient; _translateClient = translateClient; }
public TranslateController(ILogger <TranslateController> logger, ITranslateClient translateClient) { _logger = logger; _translateClient = translateClient; }
public void Init() { client = new TranslateClient(); }
public UsersController(ICustomerMasterClient customerMasterClient, ITranslateClient translateClient) { _customerMasterClient = customerMasterClient; _translateClient = translateClient; }