private void EditItemButton_Click(object sender, EventArgs e) { if (ItemList.SelectedItems.Count != 1) { return; } ItemPos ip = ItemList.SelectedItems[0].Tag as ItemPos; using (ItemPosForm form = new ItemPosForm()) { form.Setup(Context, ip); if (form.ShowDialog() == DialogResult.OK) { form.Apply(); Context.UnsavedChanges = true; UpdateItemList(); } } }
private void AddItemButton_Click(object sender, EventArgs e) { ItemPos ip = new ItemPos { X = (byte)CurrentTile.X, Y = (byte)CurrentTile.Y, }; using (ItemPosForm form = new ItemPosForm()) { form.Setup(Context, ip); if (form.ShowDialog() == DialogResult.OK) { form.Apply(); Zone.Items.Add(ip); Context.UnsavedChanges = true; UpdateItemList(); } } }