private void saveToolStripButton_Click(object sender, EventArgs e) { //CommandSaveRotiList saveRoti = new CommandSaveRotiList(m_List); //m_AppController.ExecuteCommand(saveRoti); if (m_List == null) { return; } RotiToChooseItem changeItem = (RotiToChooseItem)bindingSource1.Current; if (changeItem == null) { return; } if (isNewRecord) { CommandInsertRoti newRoti = new CommandInsertRoti(changeItem); m_AppController.ExecuteCommand(newRoti); } else { CommandUpdateRoti updateRoti = new CommandUpdateRoti(changeItem); m_AppController.ExecuteCommand(updateRoti); } }
private void bindingSource1_ListChanged(object sender, ListChangedEventArgs e) { // Exit if no project list if (m_List == null) { return; } // Get the item affected int index = e.NewIndex; RotiToChooseItem changedItem = null; if ((index > -1) && (index < m_List.Count)) { changedItem = m_List[index]; } // Get the type of change that occured ListChangedType changeType = e.ListChangedType; // Dispatch a change handler switch (changeType) { case ListChangedType.ItemChanged: CommandUpdateRoti updateRoti = new CommandUpdateRoti(changedItem); m_AppController.ExecuteCommand(updateRoti); break; case ListChangedType.ItemMoved: // Not supported in this app break; } }