Merge pull request #3772 from sylveon/master

Make code prettier
This commit is contained in:
Jaex 2018-11-19 22:37:23 +03:00 committed by GitHub
commit fd0719bcd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -302,7 +302,9 @@ protected override void WndProc(ref Message m)
{
if (m.Msg == (int)WindowsMessages.QUERYENDSESSION)
{
EndSessionReasons reason = (EndSessionReasons)(m.LParam.ToInt64() & 0xFFFFFFFF);
// Calling ToInt64 because the int conversion operator (called when directly casting the IntPtr to the enum)
// enforces checked semantics thus crashes any 64 bits build. ToInt64() and long -> enum conversion doesn't.
EndSessionReasons reason = (EndSessionReasons)m.LParam.ToInt64();
if (reason.HasFlag(EndSessionReasons.ENDSESSION_CLOSEAPP))
{
// Register for restart. This allows our application to automatically restart when it is installing an update from the Store.