static void AddEventClicked(object sender, EventArgs e) { // add event, new event, add new event AddEventWindow addEventWindow = new AddEventWindow(); if (addEventWindow.ShowDialog(MainGlueWindow.Self) == DialogResult.OK) { HandleAddEventOk(addEventWindow); } }
private static void HandleAddEventOk(AddEventWindow addEventWindow) { string resultName = addEventWindow.ResultName; IElement currentElement = EditorLogic.CurrentElement; #region Show message boxes if there is an error with the variable bool isInvalid = IsVariableInvalid(null, resultName, currentElement); #endregion if (!isInvalid) { EventResponseSave eventResponseSave = new EventResponseSave(); eventResponseSave.EventName = resultName; eventResponseSave.SourceObject = addEventWindow.TunnelingObject; eventResponseSave.SourceObjectEvent = addEventWindow.TunnelingEvent; eventResponseSave.SourceVariable = addEventWindow.SourceVariable; eventResponseSave.BeforeOrAfter = addEventWindow.BeforeOrAfter; eventResponseSave.DelegateType = addEventWindow.ResultDelegateType; AddEventToElementAndSave(currentElement, eventResponseSave); } }
public static void ShowAddEventWindow(NamedObjectSave objectToTunnelInto) { AddEventWindow addEventWindow = new AddEventWindow(); addEventWindow.DesiredEventType = CustomEventType.Tunneled; addEventWindow.TunnelingObject = objectToTunnelInto.InstanceName;; if (addEventWindow.ShowDialog(MainGlueWindow.Self) == DialogResult.OK) { HandleAddEventOk(addEventWindow); } }