private void CheckMissingTranslation(string textId, string defaultText) { if (LogOutMissingTranslations) { bool needLogUpdate = false; AvailableLanguages.Where(al => al != null).ToList().ForEach(languageId => { if (!Translators.Any(tr => tr.CanTranslate(textId, languageId))) { if (!MissingTranslations.ContainsKey(textId)) { MissingTranslations.Add(textId, new SortedDictionary <string, string>()); } MissingTranslations[textId][languageId] = $"default text : {defaultText}"; needLogUpdate = true; } }); if (needLogUpdate) { MissingTranslationFound?.Invoke(this, new LocalizationMissingTranslationEventArgs(this, MissingTranslations, textId)); } } }
public RootViewModel( IServerResponseService serverResponseService, IFileProcessService fileProcessService, IConfigurationService _configurationService, IRecordService recordService) { _recordService = recordService; _recordService.RecordStopped += delegate { IsTranscribingInProgress = false; }; _recordService.InfoMessage += delegate(object _sender, string message) { InfoMessage = message; }; _recordService.RecordLevel += delegate(object _sender, float level) { RecordLevel = level; }; _fontSizes = new int[] { 8, 12, 14, 16, 18, 20, 22, 24, 26 }; _selectedFontSize = _fontSizes[3]; _transportService = Mvx.IoCProvider.Resolve <ITransportService>(); _transportService.InfoMessage += delegate(object _sender, string message) { InfoMessage = message; }; _configurationService = new ConfigurationService(); _fileProcessService = fileProcessService; _fileProcessService.PercentageTranscribed += UpdatePercentageTranscribed; _fileProcessService.InfoMessage += delegate(object _sender, string message) { InfoMessage = message; }; _serverResponseService = serverResponseService; _serverResponseService.HandledServerResponse += delegate(object _sender, string resp) { Transcription = resp; }; _serverResponseService.InfoMessage += delegate(object _sender, string message) { InfoMessage = message; }; ToggleTranscriptionCommand = new MvxCommand(StartTranscribing); ClearTextCommand = new MvxCommand(_serverResponseService.Clear); TranscribeFileCommand = new MvxAsyncCommand(TranscribeFile); AvailableLanguages = _configurationService.GetLanguages().ToArray(); if (AvailableLanguages.Count() != 0) { SelectedLanguage = AvailableLanguages.Where(x => x.Key.ToLower() == "russian").FirstOrDefault(); } }