private void btnSearch_Click(object sender, EventArgs e) { //If grid contains rows, build normal filter string if (dgvFilters.Rows.Count >= 1) { whereClause = BuildFilter(); } //Otherwise, just use the values in the combo boxes and text box to build the filter else if (!txtSearch1.Text.Equals(string.Empty) || !txtSearch1.Text.Equals("Search Text Here...")) { whereClause = BuildFilterNoRows(); } if (optionalClause.Equals("")) { query = $"SELECT * FROM {tableName} WHERE {whereClause};"; } else { query = $"SELECT * FROM {tableName} WHERE {optionalClause} AND {whereClause};"; } FilterDoneEventArgs args = new FilterDoneEventArgs(Database.ExecuteFilter(query), query); if (args.Results == null || args.Results.Rows.Count <= 0) { CMessageBox.Show("No records found with that filter.\nTry to refine it.", "No Records", MessageBoxButtons.OK, Resources.warning_64x64); } else { FilterDone?.Invoke(this, args); Close(); } }
/// <summary> /// All of the User controls that are considered setting screens implement the ISettingsControl interface. /// <para>Iterates through all of them that have been opened and calls the ToDefaults() method.</para> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnToDefaults_Click(object sender, EventArgs e) { DialogResult result = CMessageBox.Show("Are you sure you want to reset settings? Changes do not save unless you click the \"Save\" button.", "Confirm", MessageBoxButtons.YesNo, Resources.warning_64x64); if (result == DialogResult.Yes) { foreach (ISettingsControl c in settingControls) { c.ToDefaults(); } } }
private void BtnActivate_Click(object sender, EventArgs e) { if (txtName.Text.Length > 0 && txtKey.Text.Length > 0) { Settings.Default.DeveloperName = txtName.Text; Settings.Default.DeveloperKey = txtKey.Text; Settings.Default.Save(); DialogResult = DialogResult.OK; Close(); } else { CMessageBox.Show("Fields cannot be empty!", "Invalid Input", MessageBoxButtons.OK, Resources.error_64x64); return; } }
private void btnFinish_Click(object sender, EventArgs e) { if (txtProductKey.Text.Length <= 0) { CMessageBox.Show("Product Key cannot be empty!", "Error", MessageBoxButtons.OK, Resources.error_64x64); lblActivationStatus.Text = "Status: The product key was empty."; Size = new Size(Size.Width, 168); return; } LicenseInfo temp = LicenseEngine.GetLicenseInfo(txtProductKey.Text); if (!temp.IsEmpty) { if (temp.Type == utility.Licensing.LicenseType.Trial) { if (DateTime.Now.Date >= temp.ExpirationDate.Date) { CMessageBox.Show($"Trial key is no longer valid for use. " + $"It expired on: {temp.ExpirationDate.Date.ToShortDateString()}. " + "You can request a new one by using the \"Purchase New Product Key\" button.", "Error", MessageBoxButtons.OK, Resources.error_64x64); lblActivationStatus.Text = "Status: Invalid trial key; expired."; return; } } lblActivationStatus.Text = "Status: Successful!"; Settings.Default.ProductKey = txtProductKey.Text; Settings.Default.Save(); info = temp; infoPropGrid.SelectedObject = info; Size = new Size(Size.Width, 370); } else { CMessageBox.Show("Invalid product key!", "Error", MessageBoxButtons.OK, Resources.error_64x64); lblActivationStatus.Text = "Status: The product key you entered was invalid."; Size = new Size(Size.Width, 168); return; } }