/// <summary>
 /// Locks the orientation of the containing document to its default orientation
 /// </summary>
 /// <returns></returns>
 public async ValueTask Lock(ScreenOrientationTypeEnum newOrientation)
 {
     await jsRuntime.InvokeInstanceMethod(screenRef, "orientation.lock", newOrientation switch
     {
         ScreenOrientationTypeEnum.Any => "any",
         ScreenOrientationTypeEnum.Natural => "natural",
         ScreenOrientationTypeEnum.Landscape => "landscape",
         ScreenOrientationTypeEnum.Portrait => "portrait",
         ScreenOrientationTypeEnum.PortraitPrimary => "portrait-primary",
         ScreenOrientationTypeEnum.PortraitSecondary => "portrait-secondary",
         ScreenOrientationTypeEnum.LandscapePrimary => "landscape-primary",
         ScreenOrientationTypeEnum.LandscapeSecondary => "landscape-secondary",
         _ => throw new NotSupportedException($"ScreenOrientationTypeEnum: {newOrientation}")
     }).ConfigureAwait(false);
Exemple #2
0
 /// <summary>
 /// Locks the orientation of the containing document to its default orientation
 /// </summary>
 /// <returns></returns>
 public async Task Lock(ScreenOrientationTypeEnum newOrientation)
 {
     await jsRuntime.InvokeInstanceMethodAsync(windowRef, "screen.orientation.lock", newOrientation switch
     {
         ScreenOrientationTypeEnum.Any => "any",
         ScreenOrientationTypeEnum.Natural => "natural",
         ScreenOrientationTypeEnum.Landscape => "landscape",
         ScreenOrientationTypeEnum.Portrait => "portrait",
         ScreenOrientationTypeEnum.PortraitPrimary => "portrait-primary",
         ScreenOrientationTypeEnum.PortraitSecondary => "portrait-secondary",
         ScreenOrientationTypeEnum.LandscapePrimary => "landscape-primary",
         ScreenOrientationTypeEnum.LandscapeSecondary => "landscape-secondary",
         _ => throw new NotImplementedException(),
     });