private void AddItem_Shown(object sender, EventArgs e) { this.Size = new Size(329, 122); RenderCombo(); Result = null; barcode.Text = ""; nameBox.Text = ""; descriptionBox.Text = ""; taglistBox.Items.Clear(); barcode.Focus(); }
private void barcode_Leave(object sender, EventArgs e) { var item = Db.Context.Items.FirstOrDefault(n => n.Id == barcode.Text); if (item != null) { Result = item; DialogResult = DialogResult.OK; //select this item and exit dialog } else { // reveal add item ui this.Size = new Size(413, 425); } }
private void button2_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; if (isContainer.Checked) { Result = new Model.Container() { Id = barcode.Text, Name = nameBox.Text, Description = descriptionBox.Text, Added = DateTime.Now, Tags = taglistBox.Items.Cast<Model.Tag>().ToList() }; } else { Result = new Model.Item() { Id = barcode.Text, Name = nameBox.Text, Description = descriptionBox.Text, Added = DateTime.Now, Tags = taglistBox.Items.Cast<Model.Tag>().ToList() }; } }