public MainForm() { InitializeComponent(); dataContext = new DBClassesDataContext(); languageService = new LanguageService(dataContext); wordService = new WordService(dataContext); translationDBservice = new TranslationDBService(dataContext); applicationSettingsService = new ApplicationSettingsService(dataContext); titleToShortTitleMap = new Dictionary <String, String>(); selectLanguageComboBox.SelectedItem = "All"; //default insertLanguageComboBox.SelectedItem = "Polish"; //default isInternetAccess = checkInternetConnection(); if (isInternetAccess) { System.Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", "C:\\Programming\\IPNew\\IPV\\IP\\Inzenyria_programowania-ce5078cd8d32.json"); client = Google.Cloud.Translation.V2.TranslationClient.Create(); googleTranslate = new TranslationAPIService(client); foreach (Google.Cloud.Translation.V2.Language language in client.ListLanguages("en")) { if (languageService.checkIfLanguageExistsInDB(language.Name)) { insertLanguageComboBox.Items.Add(language.Name); titleToShortTitleMap.Add(language.Name, language.Code); } } } else { MessageBox.Show("Looks like you don't have internet connection, you can't add words, you can only exercise them."); } }
public MainForm() { InitializeComponent(); System.Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", "C:\\Inzenyria_programowania-ce5078cd8d32.json"); client = TranslationClient.Create(); dataContext = new DBClassesDataContext(); languageService = new LanguageService(dataContext); wordService = new WordService(dataContext); translationDBservice = new TranslationDBService(dataContext); googleTranslate = new TranslationAPIService(client); titleToShortTitleMap = new Dictionary <String, String>(); foreach (Google.Cloud.Translation.V2.Language language in client.ListLanguages("en")) { insertLanguageComboBox.Items.Add(language.Name); titleToShortTitleMap.Add(language.Name, language.Code); } insertLanguageComboBox.SelectedItem = "Polish"; //default }