示例#1
0
        private void Settings_Load(object sender, EventArgs e)
        {
            SafeLoadLanguages = LoadLanguages;
            if (gsl == null)
            {
                gsl = AsyncStatic.MakeGSL(LoadLanguages);
            }
            else
            {
                LoadLanguages(gsl);
            }

            txtGoogleKeyFile.Text     = Properties.Settings.Default.googleApiKeyPath;
            txtGoogleProjectName.Text = Properties.Settings.Default.googleProjectName;

            txtMsOcrApiKey.Text        = Properties.Settings.Default.microsoftOcrApiKey;
            txtMsOcrEndpoint.Text      = Properties.Settings.Default.microsoftOcrEndpoint;
            txtMsTranslatorApiKey.Text = Properties.Settings.Default.microsoftTranslatorApiKey;

            txtDeepLKey.Text = Properties.Settings.Default.DeepLKey;

            cboOCR.Items.Clear();
            cboOCR.Items.AddRange(ocrSources);
            cboOCR.SelectedItem = cboOCR.Items
                                  .Cast <ComboBoxItem <DataSource> >()
                                  .First(item => item.data == Properties.Settings.Default.OCRDataSource);

            cboTranslation.Items.Clear();
            cboTranslation.Items.AddRange(translationSources);
            cboTranslation.SelectedItem = cboTranslation.Items
                                          .Cast <ComboBoxItem <DataSource> >()
                                          .First(item => item.data == Properties.Settings.Default.TranslationDataSource);

            cbxDisplayTimes.Checked = Properties.Settings.Default.displayTimes;
            numRateLimit.Value      = Properties.Settings.Default.reqsPerSecond;
        }
示例#2
0
 // This setting needs to be split across each translation data source.
 // Some re-engineering may be involved.
 private void btnRefreshGSL_Click(object sender, EventArgs e)
 {
     gsl = AsyncStatic.MakeGSL(LoadLanguages);
 }