private void KanBan_ItemClicked(object sender, ItemClickedEventArgs e) { var childWindow = new CreateEditItemChildWindow(); var parameter = e.Parameter; if (parameter == "EDIT") { childWindow.DataContext = ((ContractSalesItem)e.Source).Clone(); childWindow.Closed += ChildWindowEditItem_Closed; childWindow.Show(); } else if (parameter == "DELETE") { DeleteFromRestServerContractSalesItem((ContractSalesItem)e.Source); _contractSalesitems.Remove(((ContractSalesItem)e.Source)); MyKanBanControl.Refresh(); } }
private void ChildWindowEditItem_Closed(object sender, EventArgs e) { ChildWindow childWindow = ((ChildWindow)sender); if (childWindow.DialogResult == true) { ContractSalesItem item = childWindow.DataContext as ContractSalesItem; if (item != null && item.CloneOf != null) //CloneOf should never be null but we never know. { //we apply the changes that were applied to the clone to the original: ContractSalesItem original = item.CloneOf; original.CompanyName = item.CompanyName; original.PrimaryContact = item.PrimaryContact; original.ZenDeskTicketId = item.ZenDeskTicketId; original.StatusInSalesCycle = item.StatusInSalesCycle; original.Order = item.Order; original.Comments = item.Comments; UpdateRestServerContractSalesItem(original); MyKanBanControl.Refresh(); } } }