public static void CreateDirectory(string directoryPath) { ITelemetryTracker telemetryTracker = new TelemetryTracker(); try { telemetryTracker.StartTrackRequest("Creating the directory"); telemetryTracker.TrackEvent("Creating the directory", null); if (!Directory.Exists(directoryPath)) { Directory.CreateDirectory(directoryPath); } else { RemoveDirectoryFiles(directoryPath); } } catch (Exception e) { telemetryTracker.TrackException(new ProjectTermsException(PluginResources.Error_CreateDirectory + e.Message)); telemetryTracker.TrackTrace((new ProjectTermsException(PluginResources.Error_CreateDirectory + e.Message)).StackTrace, Microsoft.ApplicationInsights.DataContracts.SeverityLevel.Error); throw new ProjectTermsException(PluginResources.Error_CreateDirectory + e.Message); } }
//public Task OnAppearing() //{ // throw new NotImplementedException(); //} //public Task OnDisappearing() //{ // throw new NotImplementedException(); //} internal async Task LoadProducts() { using (var telemetry = new TelemetryTracker <ProductsRequestEvent>(new ProductsRequestEvent())) { try { var result = await _serviceClient.RetrieveProductsAsync(); Items = new ObservableCollection <ItemViewModel>(result.Select(item => ItemViewModel.FromDto(item))); } catch (Exception ex) { telemetry.Event.Exception = ex; } } }
private void IncludeTermbaseInStudio(ITermbase termbase, TermbaseGeneration termbaseCreator, string termbasePath) { ITelemetryTracker telemetryTracker = new TelemetryTracker(); try { telemetryTracker.StartTrackRequest("Including the termbase into Trados Studio"); telemetryTracker.TrackEvent("Including the termbase into Trados Studio", null); #region TbConfig var project = SdlTradosStudio.Application.GetController <ProjectsController>().CurrentProject; TermbaseConfiguration termbaseConfig = project.GetTermbaseConfiguration(); #endregion #region AddTb var studioTermbase = new LocalTermbase(termbasePath); termbaseConfig.Termbases.Add(studioTermbase); #endregion #region TermRecOptions TermRecognitionOptions options = termbaseConfig.TermRecognitionOptions; options.MinimumMatchValue = 50; options.SearchDepth = 200; options.ShowWithNoAvailableTranslation = true; options.SearchOrder = TermbaseSearchOrder.Hierarchical; #endregion #region TermbaseLanguageIndex var langs = termbaseCreator.GetProjectLanguages(); termbaseConfig.LanguageIndexes.Clear(); foreach (var lang in langs.Keys) { termbaseConfig.LanguageIndexes.Add(new TermbaseLanguageIndex(new Language(CultureInfo.GetCultureInfo(langs[lang])), lang)); } #endregion #region UpdateTermbaseConfiguration project.UpdateTermbaseConfiguration(termbaseConfig); #endregion } catch (Exception e) { telemetryTracker.TrackException(new UploadTermbaseException(PluginResources.Error_IncludeTermbaseInStudio + e.Message)); telemetryTracker.TrackTrace((new UploadTermbaseException(PluginResources.Error_IncludeTermbaseInStudio + e.Message)).StackTrace, Microsoft.ApplicationInsights.DataContracts.SeverityLevel.Error); throw new UploadTermbaseException(PluginResources.Error_IncludeTermbaseInStudio + e.Message); } }
public CaptureRequestMiddleware(RequestDelegate next, string loggingLevel, TelemetryTracker telemetryTracker) { _loggingLevel = loggingLevel; _next = next; _telemetryTracker = telemetryTracker; }
public AddressesController(ApiDbContext context, TelemetryTracker telemetryTracker) { _db = context; _telemetryTracker = telemetryTracker; }