diff --git a/Directory.Build.props b/Directory.Build.props index 73569d08ad..377fccf275 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,6 +11,11 @@ true false + + + enable all diff --git a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj index 687e98aa9f..a445b78fac 100644 --- a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj +++ b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj @@ -23,14 +23,6 @@ 1.0 1 - - - true IL2026 diff --git a/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj b/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj index 140af48816..b0c9015058 100644 --- a/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj +++ b/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj @@ -2,7 +2,6 @@ $(NetVersion) - true $(BaseIntermediateOutputPath)\GF true true diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj index d258ea2461..807415e985 100644 --- a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj +++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj @@ -51,6 +51,10 @@ + + + + diff --git a/src/CommunityToolkit.Maui.Camera/Interfaces/ICameraView.shared.cs b/src/CommunityToolkit.Maui.Camera/Interfaces/ICameraView.shared.cs index 1b98bd1ee6..5dbfadcaf9 100644 --- a/src/CommunityToolkit.Maui.Camera/Interfaces/ICameraView.shared.cs +++ b/src/CommunityToolkit.Maui.Camera/Interfaces/ICameraView.shared.cs @@ -16,7 +16,7 @@ public interface ICameraView : IView Size ImageCaptureResolution { get; } /// - /// Gets a value indicating whether the torch is on. + /// Gets a value indicating whether the torch (flash) is on. /// bool IsTorchOn { get; } @@ -39,12 +39,12 @@ public interface ICameraView : IView float ZoomFactor { get; internal set; } /// - /// Gets whether the implementation is available. + /// Gets a value indicating whether the camera feature is available on the current device. /// bool IsAvailable { get; internal set; } /// - /// Gets whether the implementation is busy. + /// Gets a value indicating whether the camera is currently busy. /// bool IsBusy { get; internal set; } diff --git a/src/CommunityToolkit.Maui.Camera/Primitives/CameraViewDefaults.shared.cs b/src/CommunityToolkit.Maui.Camera/Primitives/CameraViewDefaults.shared.cs index e946945a6e..ec74d93a4e 100644 --- a/src/CommunityToolkit.Maui.Camera/Primitives/CameraViewDefaults.shared.cs +++ b/src/CommunityToolkit.Maui.Camera/Primitives/CameraViewDefaults.shared.cs @@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.Core; /// Default Values for [EditorBrowsable(EditorBrowsableState.Never)] -public static class CameraViewDefaults +static class CameraViewDefaults { /// /// Default value for @@ -38,34 +38,4 @@ public static class CameraViewDefaults /// Default value for /// public static CameraFlashMode CameraFlashMode { get; } = CameraFlashMode.Off; - - internal static Command CreateCaptureImageCommand(BindableObject bindable) - { - var cameraView = (CameraView)bindable; - return new(async token => await cameraView.CaptureImage(token).ConfigureAwait(false)); - } - - internal static Command CreateStartCameraPreviewCommand(BindableObject bindable) - { - var cameraView = (CameraView)bindable; - return new(async token => await cameraView.StartCameraPreview(token).ConfigureAwait(false)); - } - - internal static ICommand CreateStopCameraPreviewCommand(BindableObject bindable) - { - var cameraView = (CameraView)bindable; - return new Command(_ => cameraView.StopCameraPreview()); - } - - internal static Command CreateStartVideoRecordingCommand(BindableObject bindable) - { - var cameraView = (CameraView)bindable; - return new Command(async stream => await cameraView.StartVideoRecording(stream).ConfigureAwait(false)); - } - - internal static Command CreateStopVideoRecordingCommand(BindableObject bindable) - { - var cameraView = (CameraView)bindable; - return new Command(async token => await cameraView.StopVideoRecording(token).ConfigureAwait(false)); - } } \ No newline at end of file diff --git a/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs b/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs index abe92387e1..7d31ea60a3 100644 --- a/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs +++ b/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs @@ -1,5 +1,4 @@ using System.ComponentModel; -using System.Runtime.Versioning; using System.Windows.Input; using CommunityToolkit.Maui.Core; using CommunityToolkit.Maui.Core.Handlers; @@ -7,87 +6,10 @@ namespace CommunityToolkit.Maui.Views; /// -/// A visual element that provides the ability to show a camera preview and capture images. +/// A that provides the ability to show a camera preview and capture images and record video. /// public partial class CameraView : View, ICameraView, IDisposable { - static readonly BindablePropertyKey isAvailablePropertyKey = - BindableProperty.CreateReadOnly(nameof(IsAvailable), typeof(bool), typeof(CameraView), CameraViewDefaults.IsAvailable); - - /// - /// Backing for the property. - /// - public static readonly BindableProperty CameraFlashModeProperty = - BindableProperty.Create(nameof(CameraFlashMode), typeof(CameraFlashMode), typeof(CameraView), CameraViewDefaults.CameraFlashMode); - - /// - /// Backing for the property. - /// - public static readonly BindableProperty IsTorchOnProperty = - BindableProperty.Create(nameof(IsTorchOn), typeof(bool), typeof(CameraView), CameraViewDefaults.IsTorchOn); - - /// - /// Backing for the property. - /// - public static readonly BindableProperty IsAvailableProperty = isAvailablePropertyKey.BindableProperty; - - static readonly BindablePropertyKey isCameraBusyPropertyKey = - BindableProperty.CreateReadOnly(nameof(IsCameraBusy), typeof(bool), typeof(CameraView), CameraViewDefaults.IsCameraBusy); - - /// - /// Backing for the property. - /// - public static readonly BindableProperty IsCameraBusyProperty = isCameraBusyPropertyKey.BindableProperty; - - /// - /// Backing for the property. - /// - public static readonly BindableProperty? SelectedCameraProperty = BindableProperty.Create(nameof(SelectedCamera), - typeof(CameraInfo), typeof(CameraView), null, defaultBindingMode: BindingMode.TwoWay); - - /// - /// Backing for the property. - /// - public static readonly BindableProperty ZoomFactorProperty = - BindableProperty.Create(nameof(ZoomFactor), typeof(float), typeof(CameraView), CameraViewDefaults.ZoomFactor, coerceValue: CoerceZoom, defaultBindingMode: BindingMode.TwoWay); - - /// - /// Backing for the property. - /// - public static readonly BindableProperty ImageCaptureResolutionProperty = BindableProperty.Create(nameof(ImageCaptureResolution), - typeof(Size), typeof(CameraView), CameraViewDefaults.ImageCaptureResolution, defaultBindingMode: BindingMode.TwoWay); - - /// - /// Backing BindableProperty for the property. - /// - public static readonly BindableProperty CaptureImageCommandProperty = - BindableProperty.CreateReadOnly(nameof(CaptureImageCommand), typeof(Command), typeof(CameraView), null, BindingMode.OneWayToSource, defaultValueCreator: CameraViewDefaults.CreateCaptureImageCommand).BindableProperty; - - /// - /// Backing BindableProperty for the property. - /// - public static readonly BindableProperty StartCameraPreviewCommandProperty = - BindableProperty.CreateReadOnly(nameof(StartCameraPreviewCommand), typeof(Command), typeof(CameraView), null, BindingMode.OneWayToSource, defaultValueCreator: CameraViewDefaults.CreateStartCameraPreviewCommand).BindableProperty; - - /// - /// Backing BindableProperty for the property. - /// - public static readonly BindableProperty StopCameraPreviewCommandProperty = - BindableProperty.CreateReadOnly(nameof(StopCameraPreviewCommand), typeof(ICommand), typeof(CameraView), null, BindingMode.OneWayToSource, defaultValueCreator: CameraViewDefaults.CreateStopCameraPreviewCommand).BindableProperty; - - /// - /// Backing BindableProperty for the property. - /// - public static readonly BindableProperty StartVideoRecordingCommandProperty = - BindableProperty.CreateReadOnly(nameof(StartVideoRecordingCommand), typeof(Command), typeof(CameraView), null, BindingMode.OneWayToSource, defaultValueCreator: CameraViewDefaults.CreateStartVideoRecordingCommand).BindableProperty; - - /// - /// Backing BindableProperty for the property. - /// - public static readonly BindableProperty StopVideoRecordingCommandProperty = - BindableProperty.CreateReadOnly(nameof(StopVideoRecordingCommand), typeof(Command), typeof(CameraView), null, BindingMode.OneWayToSource, defaultValueCreator: CameraViewDefaults.CreateStopVideoRecordingCommand).BindableProperty; - - readonly SemaphoreSlim captureImageSemaphoreSlim = new(1, 1); readonly WeakEventManager weakEventManager = new(); @@ -114,96 +36,82 @@ public event EventHandler MediaCaptured remove => weakEventManager.RemoveEventHandler(value); } - /// - /// Gets a value indicating whether the camera feature is available on the current device. - /// - public bool IsAvailable => (bool)GetValue(IsAvailableProperty); + static ICameraProvider CameraProvider => IPlatformApplication.Current?.Services.GetRequiredService() ?? throw new CameraException("Unable to retrieve CameraProvider"); - /// - /// Gets a value indicating whether the camera is currently busy. - /// - public bool IsCameraBusy => (bool)GetValue(IsCameraBusyProperty); + /// + [BindableProperty(DefaultValue = CameraViewDefaults.IsAvailable)] + public partial bool IsAvailable { get; } + + /// + [BindableProperty(DefaultValue = CameraViewDefaults.IsCameraBusy)] + public partial bool IsBusy { get; } /// - /// Gets the Command that triggers an image capture. + /// Gets the that triggers an image capture. /// /// /// has a of Command<CancellationToken> which requires a as a CommandParameter. See and for more information on passing a into as a CommandParameter /// - public Command CaptureImageCommand => (Command)GetValue(CaptureImageCommandProperty); + [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateCaptureImageCommand), DefaultBindingMode = BindingMode.OneWayToSource)] + public partial Command CaptureImageCommand { get; } /// - /// Gets the Command that starts the camera preview. + /// Gets the that starts the camera preview. /// - /// /// + /// /// has a of Command<CancellationToken> which requires a as a CommandParameter. See and for more information on passing a into as a CommandParameter /// - public Command StartCameraPreviewCommand => (Command)GetValue(StartCameraPreviewCommandProperty); + [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateStartCameraPreviewCommand), DefaultBindingMode = BindingMode.OneWayToSource)] + public partial Command StartCameraPreviewCommand { get; } /// - /// Gets the Command that stops the camera preview. + /// Gets the that stops the camera preview. /// - public ICommand StopCameraPreviewCommand => (ICommand)GetValue(StopCameraPreviewCommandProperty); + /// + /// has a of Command<CancellationToken> which requires a as a CommandParameter. See and for more information on passing a into as a CommandParameter + /// + [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateStopCameraPreviewCommand), DefaultBindingMode = BindingMode.OneWayToSource)] + public partial Command StopCameraPreviewCommand { get; } /// - /// Gets the Command that starts video recording. + /// Gets the that starts video recording. /// /// - /// has a of Command<Stream> which requires a as a CommandParameter. - /// The parameter represents the destination where the recorded video will be saved. - /// See and for more information on passing a into as a CommandParameter. + /// has a of Command<Stream> which requires a as a CommandParameter. See and for more information on passing a into as a CommandParameter /// - public Command StartVideoRecordingCommand => (Command)GetValue(StartVideoRecordingCommandProperty); + [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateStartVideoRecordingCommand), DefaultBindingMode = BindingMode.OneWayToSource)] + public partial Command StartVideoRecordingCommand { get; } /// - /// Gets the Command that stops video recording. + /// Gets the that stops video recording. /// /// - /// has a of Command<CancellationToken>, which requires a as a CommandParameter. - /// See and for more information on passing a into as a CommandParameter. + /// has a of Command<CancellationToken> which requires a as a CommandParameter. See and for more information on passing a into as a CommandParameter /// - public Command StopVideoRecordingCommand => (Command)GetValue(StopVideoRecordingCommandProperty); + [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateStopVideoRecordingCommand), DefaultBindingMode = BindingMode.OneWayToSource)] + public partial Command StopVideoRecordingCommand { get; } - /// - /// Gets or sets the . - /// - public CameraFlashMode CameraFlashMode - { - get => (CameraFlashMode)GetValue(CameraFlashModeProperty); - set => SetValue(CameraFlashModeProperty, value); - } + /// + [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateCameraFlashMode))] + public partial CameraFlashMode CameraFlashMode { get; set; } /// - public CameraInfo? SelectedCamera - { - get => (CameraInfo?)GetValue(SelectedCameraProperty); - set => SetValue(SelectedCameraProperty, value); - } + [BindableProperty(DefaultBindingMode = BindingMode.TwoWay)] + public partial CameraInfo? SelectedCamera { get; set; } /// - public float ZoomFactor - { - get => (float)GetValue(ZoomFactorProperty); - set => SetValue(ZoomFactorProperty, value); - } + [BindableProperty(DefaultValue = CameraViewDefaults.ZoomFactor, DefaultBindingMode = BindingMode.TwoWay, CoerceValueMethodName = nameof(CoerceZoom))] + public partial float ZoomFactor { get; set; } /// - public Size ImageCaptureResolution - { - get => (Size)GetValue(ImageCaptureResolutionProperty); - set => SetValue(ImageCaptureResolutionProperty, value); - } + [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateImageCaptureResolution), DefaultBindingMode = BindingMode.TwoWay)] + public partial Size ImageCaptureResolution { get; set; } - /// - /// Gets or sets a value indicating whether the torch (flash) is on. - /// - public bool IsTorchOn - { - get => (bool)GetValue(IsTorchOnProperty); - set => SetValue(IsTorchOnProperty, value); - } + /// + [BindableProperty(DefaultValue = CameraViewDefaults.IsTorchOn)] + public partial bool IsTorchOn { get; set; } - static ICameraProvider CameraProvider => IPlatformApplication.Current?.Services.GetRequiredService() ?? throw new CameraException("Unable to retrieve CameraProvider"); + new CameraViewHandler Handler => (CameraViewHandler)(base.Handler ?? throw new InvalidOperationException("Unable to retrieve Handler")); [EditorBrowsable(EditorBrowsableState.Never)] bool ICameraView.IsAvailable @@ -215,12 +123,10 @@ bool ICameraView.IsAvailable [EditorBrowsable(EditorBrowsableState.Never)] bool ICameraView.IsBusy { - get => IsCameraBusy; - set => SetValue(isCameraBusyPropertyKey, value); + get => IsBusy; + set => SetValue(isBusyPropertyKey, value); } - new CameraViewHandler Handler => (CameraViewHandler)(base.Handler ?? throw new InvalidOperationException("Unable to retrieve Handler")); - /// public void Dispose() { @@ -235,6 +141,7 @@ public async ValueTask> GetAvailableCameras(Cancellati { await CameraProvider.RefreshAvailableCameras(token); } + return CameraProvider.AvailableCameras ?? throw new CameraException("No camera available on device"); } @@ -323,14 +230,38 @@ protected virtual void Dispose(bool disposing) } } - void ICameraView.OnMediaCaptured(Stream imageData) + static object CreateImageCaptureResolution(BindableObject bindable) => CameraViewDefaults.ImageCaptureResolution; + + static object CreateCameraFlashMode(BindableObject bindable) => CameraViewDefaults.CameraFlashMode; + + static Command CreateCaptureImageCommand(BindableObject bindable) { - weakEventManager.HandleEvent(this, new MediaCapturedEventArgs(imageData), nameof(MediaCaptured)); + var cameraView = (CameraView)bindable; + return new(async token => await cameraView.CaptureImage(token).ConfigureAwait(false)); } - void ICameraView.OnMediaCapturedFailed(string failureReason) + static Command CreateStartCameraPreviewCommand(BindableObject bindable) { - weakEventManager.HandleEvent(this, new MediaCaptureFailedEventArgs(failureReason), nameof(MediaCaptureFailed)); + var cameraView = (CameraView)bindable; + return new(async token => await cameraView.StartCameraPreview(token).ConfigureAwait(false)); + } + + static Command CreateStopCameraPreviewCommand(BindableObject bindable) + { + var cameraView = (CameraView)bindable; + return new(_ => cameraView.StopCameraPreview()); + } + + static Command CreateStartVideoRecordingCommand(BindableObject bindable) + { + var cameraView = (CameraView)bindable; + return new(async stream => await cameraView.StartVideoRecording(stream).ConfigureAwait(false)); + } + + static Command CreateStopVideoRecordingCommand(BindableObject bindable) + { + var cameraView = (CameraView)bindable; + return new(async token => await cameraView.StopVideoRecording(token).ConfigureAwait(false)); } static object CoerceZoom(BindableObject bindable, object value) @@ -354,4 +285,14 @@ static object CoerceZoom(BindableObject bindable, object value) return input; } + + void ICameraView.OnMediaCaptured(Stream imageData) + { + weakEventManager.HandleEvent(this, new MediaCapturedEventArgs(imageData), nameof(MediaCaptured)); + } + + void ICameraView.OnMediaCapturedFailed(string failureReason) + { + weakEventManager.HandleEvent(this, new MediaCaptureFailedEventArgs(failureReason), nameof(MediaCaptureFailed)); + } } \ No newline at end of file diff --git a/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj b/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj index e87ba03235..feaf734467 100644 --- a/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj +++ b/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj @@ -10,7 +10,6 @@ true true - 15.0 15.0 26.0 @@ -47,8 +46,6 @@ Debug;Release $(WarningsAsErrors);CS1591 True - true - $(BaseIntermediateOutputPath)\GeneratedFiles diff --git a/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.shared.cs b/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.shared.cs index 7a87bba749..ddd454029a 100644 --- a/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.shared.cs +++ b/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.shared.cs @@ -17,7 +17,7 @@ public interface IMediaElement : IView, IAsynchronousMediaElementHandler /// Occurs when the changes; /// event EventHandler PositionChanged; - + /// /// Gets the media aspect ratio. /// @@ -95,7 +95,7 @@ public interface IMediaElement : IView, IAsynchronousMediaElementHandler /// /// A value of 1 indicates full volume, 0 is silence. double Volume { get; set; } - + /// /// Gets or sets the title of the media. /// diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs index bdf77170f1..a3946f62f6 100644 --- a/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs +++ b/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs @@ -98,7 +98,7 @@ internal event EventHandler StopRequested add => eventManager.AddEventHandler(value); remove => eventManager.RemoveEventHandler(value); } - + /// /// Gets the in pixels. /// @@ -110,13 +110,13 @@ internal event EventHandler StopRequested /// [BindableProperty(DefaultValue = MediaElementDefaults.MediaWidth)] public partial int MediaWidth { get; } - + /// /// Gets the current of the media playback. /// [BindableProperty(DefaultValue = MediaElementDefaults.Position)] public partial TimeSpan Position { get; } - + /// /// Gets the of the media. /// @@ -200,13 +200,13 @@ internal event EventHandler StopRequested /// [BindableProperty(DefaultValue = MediaElementDefaults.Volume, DefaultBindingMode = BindingMode.TwoWay, PropertyChangingMethodName = nameof(OnVolumeChanging))] public partial double Volume { get; set; } - + /// /// Gets or sets the of the media. /// [BindableProperty(DefaultValue = MediaElementDefaults.CurrentState, PropertyChangedMethodName = nameof(OnCurrentStatePropertyChanged))] public partial MediaElementState CurrentState { get; private set; } - + /// TaskCompletionSource IAsynchronousMediaElementHandler.SeekCompletedTCS => seekCompletedTaskCompletionSource; @@ -342,7 +342,7 @@ static void OnSourcePropertyChanged(BindableObject bindable, object oldValue, ob { var mediaElement = (MediaElement)bindable; var source = (MediaSource?)newValue; - + mediaElement.ClearTimer(); if (source is not null) @@ -381,7 +381,7 @@ static void OnVolumeChanging(BindableObject bindable, object oldValue, object ne throw new ArgumentOutOfRangeException(nameof(newValue), $"{nameof(Volume)} can not be less than 0.0 or greater than 1.0"); } } - + void IMediaElement.MediaEnded() => OnMediaEnded(); void IMediaElement.MediaFailed(MediaFailedEventArgs args) => OnMediaFailed(args); diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs index eff2d406b1..525311ee41 100644 --- a/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs +++ b/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs @@ -21,14 +21,14 @@ public sealed partial class FileMediaSource : MediaSource /// /// A instance to convert to a string value. public static implicit operator string?(FileMediaSource? fileMediaSource) => fileMediaSource?.Path; - + /// /// Gets or sets the full path to the local file to use as a media source. /// This is a bindable property. /// [BindableProperty(PropertyChangedMethodName = nameof(OnFileMediaSourceChanged))] public partial string? Path { get; set; } - + /// public override string ToString() => $"File: {Path}"; diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs index b2b79e7a25..067dcf5e36 100644 --- a/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs +++ b/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs @@ -21,7 +21,7 @@ public sealed partial class ResourceMediaSource : MediaSource /// /// A instance to convert to a string value. public static implicit operator string?(ResourceMediaSource? resourceMediaSource) => resourceMediaSource?.Path; - + /// /// Gets or sets the full path to the resource file to use as a media source. /// This is a bindable property. @@ -32,7 +32,7 @@ public sealed partial class ResourceMediaSource : MediaSource /// [BindableProperty(PropertyChangedMethodName = nameof(OnResourceMediaSourceMediaSourceChanged))] public partial string? Path { get; set; } - + /// public override string ToString() => $"Resource: {Path}"; diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs index 11192b3c0e..f1e8b3a765 100644 --- a/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs +++ b/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs @@ -20,7 +20,7 @@ public sealed partial class UriMediaSource : MediaSource /// /// A instance to convert to a string value. public static implicit operator string?(UriMediaSource? uriMediaSource) => uriMediaSource?.Uri?.ToString(); - + /// /// Gets or sets the URI to use as a media source. /// This is a bindable property. @@ -29,7 +29,7 @@ public sealed partial class UriMediaSource : MediaSource [TypeConverter(typeof(UriTypeConverter))] [BindableProperty(PropertyChangedMethodName = nameof(OnUriSourceChanged), ValidateValueMethodName = nameof(UriValueValidator))] public partial Uri? Uri { get; set; } - + /// public override string ToString() => $"Uri: {Uri}"; diff --git a/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaElementDefaults.shared.cs b/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaElementDefaults.shared.cs index 4c02d95470..bd32fd22ac 100644 --- a/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaElementDefaults.shared.cs +++ b/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaElementDefaults.shared.cs @@ -5,32 +5,32 @@ static class MediaElementDefaults public const Aspect Aspect = Microsoft.Maui.Aspect.AspectFit; public const int MediaHeight = 0; - + public const int MediaWidth = 0; public const string Position = "00:00:00"; - + public const string Duration = "00:00:00"; public const bool ShouldAutoPlay = false; - + public const bool ShouldLoopPlayback = false; - + public const bool ShouldKeepScreenOn = false; - + public const bool ShouldMute = false; - + public const bool ShouldShowPlaybackControls = false; - + public const double Speed = 1.0; - + public const double Volume = 1.0; - + public const string MetadataTitle = ""; - + public const string MetadataArtist = ""; - + public const string MetadataArtworkUrl = ""; - + public const MediaElementState CurrentState = MediaElementState.None; } \ No newline at end of file diff --git a/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/BindablePropertyAttributeSourceGeneratorTests/CommonUsageTests.cs b/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/BindablePropertyAttributeSourceGeneratorTests/CommonUsageTests.cs index 03dad02d1f..d12688ef2f 100644 --- a/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/BindablePropertyAttributeSourceGeneratorTests/CommonUsageTests.cs +++ b/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/BindablePropertyAttributeSourceGeneratorTests/CommonUsageTests.cs @@ -351,7 +351,7 @@ public partial class {{defaultTestClassName}} : View await VerifySourceGeneratorAsync(source, string.Empty); } - + [Fact] public async Task GenerateBindableProperty_InternalSetter_GeneratesInternalSetter() { @@ -392,7 +392,7 @@ public partial class {{defaultTestClassName}} await VerifySourceGeneratorAsync(source, expectedGenerated); } - + [Fact] public async Task GenerateBindableProperty_PrivateProtectedSetter_GeneratesPrivateProtectedSetter() { diff --git a/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/BindablePropertyAttributeSourceGeneratorTests/EdgeCaseTests.cs b/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/BindablePropertyAttributeSourceGeneratorTests/EdgeCaseTests.cs index ae67355250..8de524928e 100644 --- a/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/BindablePropertyAttributeSourceGeneratorTests/EdgeCaseTests.cs +++ b/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/BindablePropertyAttributeSourceGeneratorTests/EdgeCaseTests.cs @@ -53,7 +53,7 @@ public partial class {{defaultTestClassName}} await VerifySourceGeneratorAsync(source, expectedGenerated); } - + [Fact] public async Task GenerateBindableProperty_PropertyIsByteEnum_GeneratesCorrectCode() { diff --git a/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests.csproj b/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests.csproj index 1298921517..907a488531 100644 --- a/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests.csproj +++ b/src/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests/CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests.csproj @@ -2,8 +2,6 @@ $(NetVersion) - true - $(BaseIntermediateOutputPath)\GF true true false diff --git a/src/CommunityToolkit.Maui.UnitTests/CommunityToolkit.Maui.UnitTests.csproj b/src/CommunityToolkit.Maui.UnitTests/CommunityToolkit.Maui.UnitTests.csproj index b91d6381fd..d623e274dc 100644 --- a/src/CommunityToolkit.Maui.UnitTests/CommunityToolkit.Maui.UnitTests.csproj +++ b/src/CommunityToolkit.Maui.UnitTests/CommunityToolkit.Maui.UnitTests.csproj @@ -2,9 +2,6 @@ $(NetVersion) - true - $(BaseIntermediateOutputPath)\GF - Exe CommunityToolkit.Maui.UnitTests diff --git a/src/CommunityToolkit.Maui.UnitTests/Services/PopupServiceTests.cs b/src/CommunityToolkit.Maui.UnitTests/Services/PopupServiceTests.cs index dc02bcd739..d9e1b7bb06 100644 --- a/src/CommunityToolkit.Maui.UnitTests/Services/PopupServiceTests.cs +++ b/src/CommunityToolkit.Maui.UnitTests/Services/PopupServiceTests.cs @@ -540,7 +540,7 @@ sealed class ShortLivedSelfClosingPopup(ShortLivedMockPageViewModel viewModel) : class MockSelfClosingPopup : Popup, IQueryAttributable, IDisposable { readonly TaskCompletionSource popupClosedTCS = new(); - + CancellationTokenSource? cancellationTokenSource; protected MockSelfClosingPopup(MockPageViewModel viewModel, TimeSpan displayDuration, object? result = null) @@ -552,18 +552,18 @@ protected MockSelfClosingPopup(MockPageViewModel viewModel, TimeSpan displayDura Opened += HandlePopupOpened; Closed += HandlePopupClosed; } - + ~MockSelfClosingPopup() { Dispose(false); } - + public object? Result { get; } - + public TimeSpan DisplayDuration { get; } public static Color DefaultBackgroundColor { get; } = Colors.White; - + public void Dispose() { Dispose(true); @@ -600,10 +600,10 @@ protected virtual async void HandlePopupOpened(object? sender, EventArgs e) Console.WriteLine( $@"{DateTime.Now:O} Closed {BindingContext.GetType().Name} - {Application.Current?.Windows[0].Page?.Navigation.ModalStack.Count}"); - + popupClosedTCS.SetResult(); } - + protected virtual void Dispose(bool disposing) { if (disposing) diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/CameraView/CameraViewTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/CameraView/CameraViewTests.cs index 4f4b43b517..a798aee895 100644 --- a/src/CommunityToolkit.Maui.UnitTests/Views/CameraView/CameraViewTests.cs +++ b/src/CommunityToolkit.Maui.UnitTests/Views/CameraView/CameraViewTests.cs @@ -21,7 +21,7 @@ public void VerifyDefaults() { Assert.Equal(CameraViewDefaults.IsAvailable, cameraView.IsAvailable); Assert.Equal(CameraViewDefaults.IsTorchOn, cameraView.IsTorchOn); - Assert.Equal(CameraViewDefaults.IsCameraBusy, cameraView.IsCameraBusy); + Assert.Equal(CameraViewDefaults.IsCameraBusy, cameraView.IsBusy); Assert.Equal(CameraViewDefaults.ZoomFactor, cameraView.ZoomFactor); Assert.Equal(CameraViewDefaults.ImageCaptureResolution, cameraView.ImageCaptureResolution); Assert.Equal(CameraViewDefaults.CameraFlashMode, cameraView.CameraFlashMode); diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/MediaElementTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/MediaElementTests.cs index 510f339d16..284dcc637f 100644 --- a/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/MediaElementTests.cs +++ b/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/MediaElementTests.cs @@ -17,9 +17,9 @@ public void VerifyDefaults() { // Arrange MediaElement mediaElement = new(); - + // Act - + // Assert Assert.Equal(MediaElementDefaults.MediaHeight, mediaElement.MediaHeight); Assert.Equal(MediaElementDefaults.Aspect, mediaElement.Aspect); diff --git a/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj b/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj index d681fe30d2..c299bd27e7 100644 --- a/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj +++ b/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj @@ -8,15 +8,6 @@ true true true - - - - true 15.0 diff --git a/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs b/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs index 79c86cb566..f387408ebd 100644 --- a/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs +++ b/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs @@ -117,7 +117,7 @@ public async Task CloseAsync(PopupResult result, CancellationToken token = defau // Clean up Popup resources base.Content.GestureRecognizers.Clear(); popup.PropertyChanged -= HandlePopupPropertyChanged; - + PopupClosed?.Invoke(this, result); popup.NotifyPopupIsClosed(); }