After the color indicator for pick module had been completed, for this week, I’ve implement the features that will alert user when they did not save their pick.
In order to implement the feature, I’ve used the data grid SelectionChanged event. This event will be fire when the selected item in the data grid had been changed. Therefore, I’ve retrieve the RemovedItems from the SelectionChangedEventArgs and compared its pickQuantity with database. If the pickQuantity is same with the database, it allow user to proceed with another row, reset to previous row if it is not same with database and prompt error dialog.
However, I’ve faced problem when the selected item is reset to previous item, but the focus is pointed on another row. Therefore, the PreviewLostKeyboardFocus event is used to solve the problem. It fired when the user attempt to leave the textbox focus. When the event is fired, it will work the same as the SelectionChanged event which compare the value of pickQuantity with database to verify whether user had modify the value. If the pickQuantity had been modified, it will reset the focus back to the previous textbox by using OldFocus.Focus();
