private int HandleButtonClick(int id) { // First we raise a Click event, if there is a custom button // However, we implement Close() by sending a cancel button, so // we don't want to raise a click event in response to that. if (ShowState != DialogShowState.Closing) { outerDialog.RaiseButtonClickEvent(id); } // Once that returns, we raise a Closing event for the dialog // The Win32 API handles button clicking-and-closing // as an atomic action, // but it is more .NET friendly to split them up. // Unfortunately, we do NOT have the return values at this stage. if (id < DialogsDefaults.MinimumDialogControlId) { return(outerDialog.RaiseClosingEvent(id)); } // https://msdn.microsoft.com/en-us/library/windows/desktop/bb760542(v=vs.85).aspx // The return value is specific to the notification being processed. // When responding to a button click, your implementation should return S_FALSE // if the Task Dialog is not to close. Otherwise return S_OK. return(ShowState == DialogShowState.Closing ? (int)HResult.Ok : (int)HResult.False); }
private int HandleButtonClick(int id) { // First we raise a Click event, if there is a custom button However, we implement Close() by sending a cancel button, so we // don't want to raise a click event in response to that. if (ShowState != DialogShowState.Closing) { outerDialog.RaiseButtonClickEvent(id); } // Once that returns, we raise a Closing event for the dialog The Win32 API handles button clicking-and-closing as an atomic // action, but it is more .NET friendly to split them up. Unfortunately, we do NOT have the return values at this stage. if (id < DialogsDefaults.MinimumDialogControlId) { return(outerDialog.RaiseClosingEvent(id)); } return((int)HResult.False); }
private int HandleButtonClick(int id) { // First we raise a Click event, if there is a custom button // However, we implement Close() by sending a cancel button, so // we don't want to raise a click event in response to that. if (showState != DialogShowState.Closing) { outerDialog.RaiseButtonClickEvent(id); } // Once that returns, we raise a Closing event for the dialog // The Win32 API handles button clicking-and-closing // as an atomic action, // but it is more .NET friendly to split them up. // Unfortunately, we do NOT have the return values at this stage. if (id <= 9) { return(outerDialog.RaiseClosingEvent(id)); } else { return(1); } }