private void ShutdownCancelledHandler()
 {
     if (_saveYourselfPhase)
     {
         SMLib.SmcSaveYourselfDone(_currentSmcConn, true);
     }
     _saveYourselfPhase = false;
 }
        private void ActualInteractHandler(IntPtr smcConn)
        {
            var e = new ShutdownRequestedEventArgs();

            if (_platform.Options?.EnableSessionManagement ?? false)
            {
                ShutdownRequested?.Invoke(this, e);
            }

            SMLib.SmcInteractDone(smcConn, e.Cancel);

            if (e.Cancel)
            {
                return;
            }

            _saveYourselfPhase = false;

            SMLib.SmcSaveYourselfDone(smcConn, true);
        }
        private void SaveYourselfHandler(IntPtr smcConn, IntPtr clientData, bool shutdown, bool fast)
        {
            if (_saveYourselfPhase)
            {
                SMLib.SmcSaveYourselfDone(smcConn, true);
            }

            _saveYourselfPhase = true;

            if (shutdown && !fast)
            {
                var _ = SMLib.SmcInteractRequest(smcConn, SMLib.SmDialogValue.SmDialogError,
                                                 Marshal.GetFunctionPointerForDelegate(s_smcInteractDelegate),
                                                 clientData);
            }
            else
            {
                SMLib.SmcSaveYourselfDone(smcConn, true);
                _saveYourselfPhase = false;
            }
        }