public OptionsWindowModel(OptionsWindow window, SdlMTCloudTranslationOptions options, TranslationProviderCredential credentialStore, LanguagePair[] languagePairs, Languages.Provider.Languages languages) { _languages = languages; Options = options; LanguageMappingsViewModel = new LanguageMappingsViewModel(options, this, languagePairs, _languages); LoginViewModel = new LoginViewModel(options, languagePairs, LanguageMappingsViewModel, this); _window = window; if (credentialStore == null) { return; } if (options.AuthenticationMethod.Equals("ClientLogin")) { _window.LoginTab.ClientIdBox.Password = options.ClientId; _window.LoginTab.ClientSecretBox.Password = options.ClientSecret; LoginViewModel.SelectedOption = LoginViewModel.AuthenticationOptions[0]; } else { LoginViewModel.Email = options.ClientId; _window.LoginTab.UserPasswordBox.Password = options.ClientSecret; LoginViewModel.SelectedOption = LoginViewModel.AuthenticationOptions[1]; } var projectController = AppInitializer.GetProjectController(); projectController.ProjectsChanged += ProjectController_ProjectsChanged; }
/// <summary> /// Get the current project /// </summary> /// <returns>Current project</returns> private static FileBasedProject GetCurrentProject() { return(AppInitializer.GetProjectController()?.CurrentProject); }