private void OnUserDataChanged(object sender, EventArgs eventArgs)
{
switch (DualityApp.UserData.GfxMode)
{
case ScreenMode.Window:
case ScreenMode.FixedWindow:
this.WindowState = WindowState.Normal;
this.WindowBorder = WindowBorder.Fixed;
this.ClientSize = new Size(DualityApp.UserData.GfxWidth, DualityApp.UserData.GfxHeight);
DisplayDevice.Default.RestoreResolution();
break;
case ScreenMode.Native:
case ScreenMode.Fullscreen:
this.WindowState = WindowState.Fullscreen;
this.WindowBorder = WindowBorder.Hidden;
this.ClientSize = new Size(DualityApp.UserData.GfxWidth, DualityApp.UserData.GfxHeight);
DisplayDevice.Default.ChangeResolution(DualityApp.UserData.GfxWidth, DualityApp.UserData.GfxHeight, DisplayDevice.Default.BitsPerPixel, DisplayDevice.Default.RefreshRate);
break;
default:
throw new ArgumentOutOfRangeException();
}
SetVSyncMode(this);
DualityApp.TargetResolution = new Vector2(ClientSize.Width, ClientSize.Height);
DualityApp.TargetMode = Context.GraphicsMode;
}