Пример #1
0
    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.");
        }
    }
Пример #2
0
        public WordConstructorForm(WordService wordService, DBClassesDataContext dataContext, TranslationDBService translationDBService)
        {
            InitializeComponent();
            this.dataContext          = dataContext;
            this.wordService          = wordService;
            this.translationDBservice = translationDBService;
            timer          = new Timer();
            timer.Interval = 3000;
            timer.Tick    += new EventHandler(setClickeable);

            generateWords();
        }
Пример #3
0
    public ExerciseForm(WordService wordService, DBClassesDataContext dataContext, TranslationDBService translationDBService, ApplicationSettingsService applicationSettingsService)
    {
        InitializeComponent();

        this.applicationSettingsService = applicationSettingsService;
        this.dataContext          = dataContext;
        this.wordService          = wordService;
        this.translationDBservice = translationDBService;
        timer          = new Timer();
        timer.Interval = 3000;
        timer.Tick    += new EventHandler(setClickeable);

        generateWords();
    }
    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
    }