public Form1() { if (!Settings.Default.GPL) { License l = new License(); l.ShowDialog(); if (!Settings.Default.GPL) { quit = true; Application.Exit(); this.Close(); } } InitializeComponent(); api = new OctopartAPI(); comboBox_size.SelectedIndex = 0; comboBox_type.SelectedIndex = 0; comboBox1.SelectedIndex = 0; comboBox_tolerance.SelectedIndex = 0; imageCache.Add("none", new Bitmap(1, 1)); grabPicturesToolStripMenuItem.Checked = Settings.Default.PICS; findCheapestSupplierToolStripMenuItem.Checked = Settings.Default.CHEAP; }
private void button1_Click(object sender, EventArgs e) { string type = comboBox_type.SelectedItem.ToString(); string size = comboBox_size.SelectedItem.ToString(); string tolerance = comboBox_tolerance.SelectedItem.ToString(); string value = textBox_value.Text; try { OctopartAPI.ToScientific(value); } catch { MessageBox.Show("Unable to parse value " + value); return; } if (Settings.Default.API_KEY == null || Settings.Default.API_KEY.Length == 0) { MessageBox.Show("Set API Key First (under file)"); return; } res = api.Get(size, value, (comboBox_type.SelectedIndex == 0) ? OctopartAPI.ComponentType.Capacitor : OctopartAPI.ComponentType.Resistor, tolerance); Refresh(sender, e); }