public MainWindow() { InitializeComponent(); if (File.Exists(saveTo)) { _store = MyTranslationProviderCredentialStore.FromFile(saveTo); } try { SetupTranslation(); } catch (TranslationProviderAuthenticationException ex) { var dummyProvider = new TranslationProvider(_uri, null); _ui.Edit(null, dummyProvider, null, _store); // would have used _ui.Browse() but it generates it's own uri SaveStore(); SetupTranslation(); // if this throws the second time, so be it } }
public bool Edit(IWin32Window owner, ITranslationProvider translationProvider, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore) { var tProvider = translationProvider as RecordSourceTuTmTranslationProvider; bool result = false; if (tProvider != null) { result = FileBasedTranslationProviderUi.Edit(owner, tProvider.FileBasedTranslationProvider, languagePairs, credentialStore); } using (var sourceConfigurationForm = new SourceTmConfiguration(translationProvider.Uri)) { sourceConfigurationForm.ShowDialog(); } return(result); }
public bool Edit(IWin32Window owner, ITranslationProvider translationProvider, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore) { var tProvider = translationProvider as AddSourceTmTranslationProvider; return(tProvider != null && FileBasedTranslationProviderUi.Edit(owner, tProvider.FileBasedTranslationProvider, languagePairs, credentialStore)); }