private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(maskedTextBox1.Text.Trim())) { MessageBox.Show("Please enter your Client Secret.", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } try { ld.Show(); ld.Activate(); } catch { ld = new Loading(); ld.Show(); ld.Activate(); } label4.Text = "Loading..Please Wait"; BackgroundWorker login = new BackgroundWorker(); login.DoWork += backgroundWorker1_DoWork; login.RunWorkerCompleted += backgroundWorker1_RunWorkerCompleted; login.RunWorkerAsync(); }
private void FrmHome_Load(object sender, EventArgs e) { Loading ld = new Loading(); ld.Show(); ld.Activate(); DataTable languageTable = null; try { languageTable = servRef.GetLanguages(clientID, secret); } catch (Exception exe) { if (exe.ToString().Contains("Document Limit Reached")) { MessageBox.Show("Document Limit Reached. You must purchase a license to continue, please visit www.QuillDigital.co.uk", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); System.Windows.Forms.Application.Exit(); return; } } languages.Items.Add("NONE"); foreach (DataRow langRow in languageTable.Rows) { languages.Items.Add(langRow[0].ToString()); } languages.Text = "NONE"; string pages = servRef.GetPagesLeft(clientID, secret); label8.Text = "Pages left: " + pages; extractFields.Checked = true; savePath.Text = GetConfiguration.GetConfigurationValueSaveLocation(); if (string.IsNullOrEmpty(savePath.Text.Trim())) { string runDir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); if (!Directory.Exists(Path.Combine(runDir, "TEMPS"))) { Directory.CreateDirectory(Path.Combine(runDir, "TEMPS")); } savePath.Text = Path.Combine(runDir, "TEMPS"); GetConfiguration.ConfigurationValueSaveLocation(Path.Combine(runDir, "TEMPS")); } else { savePath.Text = GetConfiguration.GetConfigurationValueSaveLocation(); } Globals.ocrType = GetConfiguration.GetConfigurationValueOCR(); Globals.meta = GetConfiguration.GetConfigurationValueMeta(); Globals.dpi = GetConfiguration.GetConfigurationValueDPI(); string refreshDate = servRef.GetRefreshDate(clientID, secret); label5.Text = refreshDate; ld.Close(); }