public void OnClose(int Reason) { m_CloseReason = (swPropertyManagerPageCloseReasons_e)Reason; var arg = new PageClosingArg(); try { Closing?.Invoke(m_CloseReason, arg); } catch (Exception ex) { arg.Cancel = true; arg.ErrorMessage = ex.Message; } if (arg.Cancel) { if (!string.IsNullOrEmpty(arg.ErrorTitle) || !string.IsNullOrEmpty(arg.ErrorMessage)) { var title = !string.IsNullOrEmpty(arg.ErrorTitle) ? arg.ErrorTitle : "Error"; m_App.HideBubbleTooltip(); m_App.ShowBubbleTooltipAt2(0, 0, (int)swArrowPosition.swArrowLeftTop, title, arg.ErrorMessage, (int)swBitMaps.swBitMapTreeError, "", "", 0, (int)swLinkString.swLinkStringNone, "", ""); } const int S_FALSE = 1; throw new COMException(arg.ErrorMessage, S_FALSE); } }