private void btnAdd_Click(object sender, EventArgs e) { // //TODO: add new item // myCmd.CurItem = new AppInfoBase(); myCmd.CurItem.type = cbType.Text; myCmd.CurItem.catalog = lstCatalog.SelectedItem.ToString(); AddItemForm addForm = new AddItemForm(myCmd); addForm.ShowDialog(); if (addForm.DialogResult != DialogResult.Cancel) { myCmd.AppDB.Add(myCmd.CurItem); UpdateAppList(); } }
private void btnEdit_Click(object sender, EventArgs e) { // //TODO: Edit current item // if (lvApp.SelectedItems.Count == 0) return; myCmd.CurItem = (AppInfoBase)myCmd.AppDB.Items[(int)lvApp.SelectedItems[0].Tag]; AddItemForm edtForm = new AddItemForm(myCmd); edtForm.ShowDialog(); if (edtForm.DialogResult != DialogResult.Cancel) { myCmd.AppDB.Items[(int)lvApp.SelectedItems[0].Tag] = myCmd.CurItem; UpdateAppList(); } }