private void tsStrengthTraining_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; try { ToolStripDropDownItem menuItem = (ToolStripDropDownItem)sender; KeyValuePair <Type, Type> pairEntry = (KeyValuePair <Type, Type>)menuItem.Tag; EntryObjectInstanceAttribute entryAttribute = new EntryObjectInstanceAttribute(); var attributes = pairEntry.Key.GetCustomAttributes(typeof(EntryObjectInstanceAttribute), true); if (attributes.Length > 0) { entryAttribute = (EntryObjectInstanceAttribute)attributes[0]; } //if this type can be only once added then we need to check if we can add it if (entryAttribute.Instance == EntryObjectInstance.Single) { if (day.ContainsSpecifiedEntry(pairEntry.Key)) { FMMessageBox.ShowError(ApplicationStrings.ErrorEntryObjectTypeAlreadyExists); return; } } var entry = day.CreateEntryObject(pairEntry.Key); try { createNewEntryControl(entry, true); day.AddEntry(entry); Cursor = Cursors.Default; } catch (TrainingIntegrationException ex) { ExceptionHandler.Default.Process(ex, ApplicationStrings.ErrorTrainingIntegrity, ErrorWindow.MessageBox); } catch (Exception ex) { ExceptionHandler.Default.Process(ex, ApplicationStrings.ErrorUnhandledException, ErrorWindow.EMailReport); } } finally { Cursor = Cursors.Default; } }