private void ButtonClicked(Base sender, ClickedEventArgs arguments) { if (sender == btn_finish.Component || sender == btn_finish_new.Component) { Function.LogDebug("ButtonClicked"); if (labeled_vehicle_type.Component.SelectedItem.UserData is String && String.IsNullOrEmpty(labeled_vehicle_type.Component.SelectedItem.UserData as String)) { OnValidationError(sender, new Dictionary <string, string>() { { "Vehicle Type", "Cannot be Select One" } }); NotifyForEvent(TrafficCitationSaveResult.SAVE_ERROR); return; } UpdateCitationFromFields(); Dictionary <String, String> failReasons; if (!Citation.Validate(out failReasons)) { OnValidationError(sender, failReasons); NotifyForEvent(TrafficCitationSaveResult.SAVE_ERROR); } else { try { Citation = ComputerReportsController.SaveTrafficCitation(Citation); //if (Globals.PendingTrafficCitation == Citation) Globals.PendingTrafficCitation = null; NotifyForEvent(TrafficCitationSaveResult.SAVE); if (sender == btn_finish_new.Component) { Globals.PendingTrafficCitation = TrafficCitation.CloneFromCitation(Citation); ChangeCitation(Globals.PendingTrafficCitation); new MessageBox(this, "Saved citation. Creating new"); BindNeeded = true; BindDataFromCitation(); } else { if (this.Container != null) { this.Container.Close(); } } } catch (Exception e) { NotifyForEvent(TrafficCitationSaveResult.SAVE_FAILED); new MessageBox(this, String.Format("Failed to save citation.. {0}", e.Message), "Failure saving"); } } } }