internal static void OrientationHandler(int orientation) { Logger.Info("Got orientation change notification for {0}", (object)orientation); bool flag = LayoutManager.ShouldEmulatePortraitMode(); Logger.Info("ShouldEmulatePortraitMode => " + flag.ToString()); if (LayoutManager.sCurrentOrientation == orientation) { Logger.Info("Not doing anything as current orientation is same as orientation requested"); } else { LayoutManager.sCurrentOrientation = orientation; LayoutManager.mRotateGuest180 = orientation == 2 || orientation == 3; if (flag) { LayoutManager.mEmulatedPortraitMode = orientation == 1 || orientation == 3; LayoutManager.mRotateGuest180 = orientation == 2 || orientation == 3; } else { LayoutManager.mEmulatedPortraitMode = false; } UIHelper.RunOnUIThread((Control)VMWindow.Instance, (UIHelper.Action)(() => { try { Logger.Info("Orientation handler calling fixguest"); if (Oem.Instance.IsResizeFrontendWindow) { LayoutManager.ResizeFrontendWindow(); } VMWindow.Instance.ResizeWindowOnStreamingMode(); LayoutManager.FixupGuestDisplay(); } catch (Exception ex) { } })); } }