Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update create.md #2667

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 36 additions & 36 deletions docs/user-interface/handlers/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,28 +341,28 @@ public partial class VideoHandler : ViewHandler<Video, MauiVideoPlayer>

public static void MapPlayRequested(VideoHandler handler, Video video, object? args)
{
if (args is not VideoPositionEventArgs)
if (args is not VideoPositionEventArgs ev)
return;

TimeSpan position = ((VideoPositionEventArgs)args).Position;
TimeSpan position = ev.Position;
handler.PlatformView?.PlayRequested(position);
}

public static void MapPauseRequested(VideoHandler handler, Video video, object? args)
{
if (args is not VideoPositionEventArgs)
if (args is not VideoPositionEventArgs ev)
return;

TimeSpan position = ((VideoPositionEventArgs)args).Position;
TimeSpan position = ev.Position;
handler.PlatformView?.PauseRequested(position);
}

public static void MapStopRequested(VideoHandler handler, Video video, object? args)
{
if (args is not VideoPositionEventArgs)
if (args is not VideoPositionEventArgs ev)
return;

TimeSpan position = ((VideoPositionEventArgs)args).Position;
TimeSpan position = ev.Position;
handler.PlatformView?.StopRequested(position);
}
...
Expand Down Expand Up @@ -576,28 +576,28 @@ public partial class VideoHandler : ViewHandler<Video, MauiVideoPlayer>

public static void MapPlayRequested(VideoHandler handler, Video video, object? args)
{
if (args is not VideoPositionEventArgs)
if (args is not VideoPositionEventArgs ev)
return;

TimeSpan position = ((VideoPositionEventArgs)args).Position;
TimeSpan position = ev.Position;
handler.PlatformView?.PlayRequested(position);
}

public static void MapPauseRequested(VideoHandler handler, Video video, object? args)
{
if (args is not VideoPositionEventArgs)
if (args is not VideoPositionEventArgs ev)
return;

TimeSpan position = ((VideoPositionEventArgs)args).Position;
TimeSpan position = ev.Position;
handler.PlatformView?.PauseRequested(position);
}

public static void MapStopRequested(VideoHandler handler, Video video, object? args)
{
if (args is not VideoPositionEventArgs)
if (args is not VideoPositionEventArgs ev)
return;

TimeSpan position = ((VideoPositionEventArgs)args).Position;
TimeSpan position = ev.Position;
handler.PlatformView?.StopRequested(position);
}
...
Expand Down Expand Up @@ -799,28 +799,28 @@ public partial class VideoHandler : ViewHandler<Video, MauiVideoPlayer>

public static void MapPlayRequested(VideoHandler handler, Video video, object? args)
{
if (args is not VideoPositionEventArgs)
if (args is not VideoPositionEventArgs ev)
return;

TimeSpan position = ((VideoPositionEventArgs)args).Position;
TimeSpan position = ev.Position;
handler.PlatformView?.PlayRequested(position);
}

public static void MapPauseRequested(VideoHandler handler, Video video, object? args)
{
if (args is not VideoPositionEventArgs)
if (args is not VideoPositionEventArgs ev)
return;

TimeSpan position = ((VideoPositionEventArgs)args).Position;
TimeSpan position = ev.Position;
handler.PlatformView?.PauseRequested(position);
}

public static void MapStopRequested(VideoHandler handler, Video video, object? args)
{
if (args is not VideoPositionEventArgs)
if (args is not VideoPositionEventArgs ev)
return;

TimeSpan position = ((VideoPositionEventArgs)args).Position;
TimeSpan position = ev.Position;
handler.PlatformView?.StopRequested(position);
}
...
Expand Down Expand Up @@ -1094,9 +1094,9 @@ namespace VideoDemos.Platforms.Android
_isPrepared = false;
bool hasSetSource = false;

if (_video.Source is UriVideoSource)
if (_video.Source is UriVideoSource source)
{
string uri = (_video.Source as UriVideoSource).Uri;
string uri = source.Uri;
if (!string.IsNullOrWhiteSpace(uri))
{
_videoView.SetVideoURI(Uri.Parse(uri));
Expand Down Expand Up @@ -1145,9 +1145,9 @@ namespace VideoDemos.Platforms.MaciOS
{
AVAsset asset = null;

if (_video.Source is UriVideoSource)
if (_video.Source is UriVideoSource source)
{
string uri = (_video.Source as UriVideoSource).Uri;
string uri = source.Uri;
if (!string.IsNullOrWhiteSpace(uri))
asset = AVAsset.FromUrl(new NSUrl(uri));
}
Expand Down Expand Up @@ -1216,9 +1216,9 @@ namespace VideoDemos.Platforms.Windows
{
bool hasSetSource = false;

if (_video.Source is UriVideoSource)
if (_video.Source is UriVideoSource source)
{
string uri = (_video.Source as UriVideoSource).Uri;
string uri = source.Uri;
if (!string.IsNullOrWhiteSpace(uri))
{
_mediaPlayerElement.Source = MediaSource.CreateFromUri(new Uri(uri));
Expand Down Expand Up @@ -1308,10 +1308,10 @@ namespace VideoDemos.Platforms.Android
bool hasSetSource = false;
...

else if (_video.Source is ResourceVideoSource)
else if (_video.Source is ResourceVideoSource source)
{
string package = Context.PackageName;
string path = (_video.Source as ResourceVideoSource).Path;
string path = source.Path;
if (!string.IsNullOrWhiteSpace(path))
{
string assetFilePath = "content://" + package + "/" + path;
Expand Down Expand Up @@ -1395,9 +1395,9 @@ namespace VideoDemos.Platforms.MaciOS
AVAsset asset = null;
...

else if (_video.Source is ResourceVideoSource)
else if (_video.Source is ResourceVideoSource source)
{
string path = (_video.Source as ResourceVideoSource).Path;
string path = source.Path;
if (!string.IsNullOrWhiteSpace(path))
{
string directory = Path.GetDirectoryName(path);
Expand Down Expand Up @@ -1459,9 +1459,9 @@ namespace VideoDemos.Platforms.Windows
bool hasSetSource = false;

...
else if (_video.Source is ResourceVideoSource)
else if (_video.Source is ResourceVideoSource source)
{
string path = "ms-appx:///" + (_video.Source as ResourceVideoSource).Path;
string path = "ms-appx:///" + source.Path;
if (!string.IsNullOrWhiteSpace(path))
{
_mediaPlayerElement.Source = MediaSource.CreateFromUri(new Uri(path));
Expand Down Expand Up @@ -1537,9 +1537,9 @@ namespace VideoDemos.Platforms.Android
bool hasSetSource = false;
...

else if (_video.Source is FileVideoSource)
else if (_video.Source is FileVideoSource source)
{
string filename = (_video.Source as FileVideoSource).File;
string filename = source.File;
if (!string.IsNullOrWhiteSpace(filename))
{
_videoView.SetVideoPath(filename);
Expand Down Expand Up @@ -1580,9 +1580,9 @@ namespace VideoDemos.Platforms.MaciOS
AVAsset asset = null;
...

else if (_video.Source is FileVideoSource)
else if (_video.Source is FileVideoSource source)
{
string uri = (_video.Source as FileVideoSource).File;
string uri = source.File;
if (!string.IsNullOrWhiteSpace(uri))
asset = AVAsset.FromUrl(NSUrl.CreateFileUrl(new [] { uri }));
}
Expand Down Expand Up @@ -1620,9 +1620,9 @@ namespace VideoDemos.Platforms.Windows
bool hasSetSource = false;

...
else if (_video.Source is FileVideoSource)
else if (_video.Source is FileVideoSource source)
{
string filename = (_video.Source as FileVideoSource).File;
string filename = source.File;
if (!string.IsNullOrWhiteSpace(filename))
{
StorageFile storageFile = await StorageFile.GetFileFromPathAsync(filename);
Expand Down
Loading