/// <summary> /// Initializes a new <see cref="PickAndPlaceLib.FootprintForm"/> /// </summary> public FootprintForm() { InitializeComponent(); cbxNozzle.DataSource = Enum.GetValues(typeof(Nozzle)); foreach (StackType stackType_ in Enum.GetValues(typeof(StackType))) { cbxStackType.Items.Add(PNPconverterTools.StackTypeToString(stackType_)); } cbxStackType.SelectedIndex = 0; try { AutoCompleteStringCollection source = new AutoCompleteStringCollection(); source.AddRange(DatabaseOperations.GetFootprintList().ToArray()); tbxMPN.AutoCompleteCustomSource = source; tbxMPN.AutoCompleteMode = AutoCompleteMode.Suggest; tbxMPN.AutoCompleteSource = AutoCompleteSource.CustomSource; tbxMPN.Leave += tbxMPN_Leave; } catch { //failed to load the database tbxMPN.AutoCompleteMode = AutoCompleteMode.None; tbxMPN.AutoCompleteSource = AutoCompleteSource.None; } }
/*-------------------------------------------------------------*/ private void cbxStackType_SelectedIndexChanged(object sender, EventArgs e) { if (cbxStackType.SelectedItem.ToString() == PNPconverterTools.StackTypeToString(StackType.Tray18mm)) { nudFeedRate.Value = 18; nudFeedRate.Enabled = false; } else { nudFeedRate.Enabled = true; } }
/// <summary> /// Sets the footprint to be edited by displaying its properties /// </summary> /// <param name="footprint">Footprint to be edited</param> public void SetFootprint(Footprint footprint) { tbxMPN.Text = footprint.ManufacturerPartNumber; nudHeight.Value = (decimal)footprint.Height; nudLength.Value = (decimal)footprint.Length; nudWidth.Value = (decimal)footprint.Width; nudRotation.Value = footprint.Rotation; bscOffset.ValueX = (decimal)footprint.OffsetStackX; bscOffset.ValueY = (decimal)footprint.OffsetStackY; cbxNozzle.SelectedItem = footprint.Nozzle; cbxStackType.SelectedItem = PNPconverterTools.StackTypeToString(footprint.StackType); nudFeedRate.Value = (decimal)footprint.FeedRate; }