@@ -533,11 +533,41 @@ private static WindowOptions CreateSilkOptions(WebGPUWindowOptions options)
533533
534534 private static Point ToPoint ( Vector2D < int > value ) => new ( value . X , value . Y ) ;
535535
536- private static NativeWindowState ToNative ( WebGPUWindowState state ) => ( NativeWindowState ) ( int ) state ;
537-
538- private static WebGPUWindowState FromNative ( NativeWindowState state ) => ( WebGPUWindowState ) ( int ) state ;
539-
540- private static NativeWindowBorder ToNative ( WebGPUWindowBorder border ) => ( NativeWindowBorder ) ( int ) border ;
541-
542- private static WebGPUWindowBorder FromNative ( NativeWindowBorder border ) => ( WebGPUWindowBorder ) ( int ) border ;
536+ private static NativeWindowState ToNative ( WebGPUWindowState state )
537+ => state switch
538+ {
539+ WebGPUWindowState . Normal => NativeWindowState . Normal ,
540+ WebGPUWindowState . Minimized => NativeWindowState . Minimized ,
541+ WebGPUWindowState . Maximized => NativeWindowState . Maximized ,
542+ WebGPUWindowState . Fullscreen => NativeWindowState . Fullscreen ,
543+ _ => throw new InvalidOperationException ( "The WebGPU window state mapping is incomplete." )
544+ } ;
545+
546+ private static WebGPUWindowState FromNative ( NativeWindowState state )
547+ => state switch
548+ {
549+ NativeWindowState . Normal => WebGPUWindowState . Normal ,
550+ NativeWindowState . Minimized => WebGPUWindowState . Minimized ,
551+ NativeWindowState . Maximized => WebGPUWindowState . Maximized ,
552+ NativeWindowState . Fullscreen => WebGPUWindowState . Fullscreen ,
553+ _ => throw new InvalidOperationException ( "The native window state mapping is incomplete." )
554+ } ;
555+
556+ private static NativeWindowBorder ToNative ( WebGPUWindowBorder border )
557+ => border switch
558+ {
559+ WebGPUWindowBorder . Resizable => NativeWindowBorder . Resizable ,
560+ WebGPUWindowBorder . Fixed => NativeWindowBorder . Fixed ,
561+ WebGPUWindowBorder . Hidden => NativeWindowBorder . Hidden ,
562+ _ => throw new InvalidOperationException ( "The WebGPU window border mapping is incomplete." )
563+ } ;
564+
565+ private static WebGPUWindowBorder FromNative ( NativeWindowBorder border )
566+ => border switch
567+ {
568+ NativeWindowBorder . Resizable => WebGPUWindowBorder . Resizable ,
569+ NativeWindowBorder . Fixed => WebGPUWindowBorder . Fixed ,
570+ NativeWindowBorder . Hidden => WebGPUWindowBorder . Hidden ,
571+ _ => throw new InvalidOperationException ( "The native window border mapping is incomplete." )
572+ } ;
543573}
0 commit comments