diff --git a/Common.Library/Common.Library.csproj b/Common.Library/Common.Library.csproj index 069991c..6405f4a 100644 --- a/Common.Library/Common.Library.csproj +++ b/Common.Library/Common.Library.csproj @@ -1,7 +1,12 @@  - net9.0 + + net9.0-android; + net9.0-ios; + net9.0-maccatalyst; + net9.0-windows10.0.19041 + enable enable diff --git a/GreadyPoang.Common/Base/BehaviorBase.cs b/GreadyPoang.Common/Base/BehaviorBase.cs index 0a2628e..f175645 100644 --- a/GreadyPoang.Common/Base/BehaviorBase.cs +++ b/GreadyPoang.Common/Base/BehaviorBase.cs @@ -2,7 +2,7 @@ public class BehaviorBase : Behavior where T : BindableObject { - public T AssociatedObject { get; private set; } + public T? AssociatedObject { get; private set; } protected override void OnAttachedTo(T bindable) { @@ -22,8 +22,9 @@ public class BehaviorBase : Behavior where T : BindableObject AssociatedObject = null; } - void OnBindingContextChanged(object sender, EventArgs e) + void OnBindingContextChanged(object? sender, EventArgs e) { - BindingContext = AssociatedObject.BindingContext; + if (AssociatedObject != null) + BindingContext = AssociatedObject.BindingContext; } } diff --git a/GreadyPoang.Common/GreadyPoang.Common.csproj b/GreadyPoang.Common/GreadyPoang.Common.csproj index 552d4ed..4938e43 100644 --- a/GreadyPoang.Common/GreadyPoang.Common.csproj +++ b/GreadyPoang.Common/GreadyPoang.Common.csproj @@ -1,7 +1,12 @@  - net9.0 + + net9.0-android; + net9.0-ios; + net9.0-maccatalyst; + net9.0-windows10.0.19041 + enable enable diff --git a/GreadyPoang.Common/Specifics/DigitsOnlyBehavior.cs b/GreadyPoang.Common/Specifics/DigitsOnlyBehavior.cs index 3d25498..4c1f2f7 100644 --- a/GreadyPoang.Common/Specifics/DigitsOnlyBehavior.cs +++ b/GreadyPoang.Common/Specifics/DigitsOnlyBehavior.cs @@ -2,21 +2,27 @@ namespace GreadyPoang.Common; -public class DigitsOnlyBehavior : Behavior +public class DigitsOnlyBehavior : Behavior { - protected override void OnAttachedTo(Entry entry) + protected override void OnAttachedTo(Entry? entry) { - entry.TextChanged += OnTextChanged; + if (entry != null) + { + entry.TextChanged += OnTextChanged; + } base.OnAttachedTo(entry); } - protected override void OnDetachingFrom(Entry entry) + protected override void OnDetachingFrom(Entry? entry) { - entry.TextChanged -= OnTextChanged; + if (entry != null) + { + entry.TextChanged -= OnTextChanged; + } base.OnDetachingFrom(entry); } - private void OnTextChanged(object sender, TextChangedEventArgs e) + private void OnTextChanged(object? sender, TextChangedEventArgs e) { var entry = sender as Entry; if (entry == null) return; diff --git a/GreadyPoang.Common/Specifics/EventToCommandBehavior.cs b/GreadyPoang.Common/Specifics/EventToCommandBehavior.cs index a888068..bc6c35b 100644 --- a/GreadyPoang.Common/Specifics/EventToCommandBehavior.cs +++ b/GreadyPoang.Common/Specifics/EventToCommandBehavior.cs @@ -4,7 +4,7 @@ using System.Windows.Input; namespace GreadyPoang.Common; public class EventToCommandBehavior : BehaviorBase { - public string EventName { get; set; } + public required string EventName { get; set; } public static readonly BindableProperty CommandProperty = BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(EventToCommandBehavior)); @@ -15,8 +15,9 @@ public class EventToCommandBehavior : BehaviorBase set => SetValue(CommandProperty, value); } - private EventInfo eventInfo; - private Delegate eventHandler; + // Fix for CS8618: Make the field nullable and fix IDE1006: Add '_' prefix + private EventInfo? _eventInfo; + private Delegate? _eventHandler; protected override void OnAttachedTo(VisualElement bindable) { @@ -25,21 +26,29 @@ public class EventToCommandBehavior : BehaviorBase if (bindable == null || string.IsNullOrEmpty(EventName)) return; - eventInfo = bindable.GetType().GetRuntimeEvent(EventName); - if (eventInfo == null) + var runtimeEvent = bindable.GetType().GetRuntimeEvent(EventName); + if (runtimeEvent == null) throw new ArgumentException($"Event '{EventName}' not found on type '{bindable.GetType().Name}'"); - MethodInfo methodInfo = typeof(EventToCommandBehavior).GetTypeInfo().GetDeclaredMethod(nameof(OnEvent)); - eventHandler = methodInfo.CreateDelegate(eventInfo.EventHandlerType, this); - eventInfo.AddEventHandler(bindable, eventHandler); + _eventInfo = runtimeEvent; + + MethodInfo? methodInfo = typeof(EventToCommandBehavior).GetTypeInfo().GetDeclaredMethod(nameof(OnEvent)); + if (methodInfo == null) + throw new InvalidOperationException($"Method '{nameof(OnEvent)}' not found on type '{typeof(EventToCommandBehavior).Name}'"); + + if (_eventInfo.EventHandlerType == null) + throw new InvalidOperationException($"EventHandlerType for event '{EventName}' is null on type '{bindable.GetType().Name}'"); + + _eventHandler = methodInfo.CreateDelegate(_eventInfo.EventHandlerType, this); + _eventInfo.AddEventHandler(bindable, _eventHandler); } protected override void OnDetachingFrom(VisualElement bindable) { base.OnDetachingFrom(bindable); - if (eventInfo != null && eventHandler != null) - eventInfo.RemoveEventHandler(bindable, eventHandler); + if (_eventInfo != null && _eventHandler != null) + _eventInfo.RemoveEventHandler(bindable, _eventHandler); } private void OnEvent(object sender, object eventArgs) diff --git a/GreadyPoang.DataLayer/DataClasses/CombinedRepository.cs b/GreadyPoang.DataLayer/DataClasses/CombinedRepository.cs index f2db7c6..46860b7 100644 --- a/GreadyPoang.DataLayer/DataClasses/CombinedRepository.cs +++ b/GreadyPoang.DataLayer/DataClasses/CombinedRepository.cs @@ -74,7 +74,7 @@ public class CombinedRepository : ICombinedRepository public IEnumerable roundBuilderElementsDbById(int GameId) { var result = _context.RoundBuilderElements - .FromSqlRaw($@" + .FromSql($@" SELECT gp.GamePointId, gp.GameRoundId, diff --git a/GreadyPoang.DataLayer/GreadyPoang.DataLayer.csproj b/GreadyPoang.DataLayer/GreadyPoang.DataLayer.csproj index 1dbefd6..33fc534 100644 --- a/GreadyPoang.DataLayer/GreadyPoang.DataLayer.csproj +++ b/GreadyPoang.DataLayer/GreadyPoang.DataLayer.csproj @@ -1,7 +1,12 @@  - net9.0 + + net9.0-android; + net9.0-ios; + net9.0-maccatalyst; + net9.0-windows10.0.19041 + enable enable diff --git a/GreadyPoang.EntityLayer/Enums/GamePointStatus.cs b/GreadyPoang.EntityLayer/Enums/GamePointStatus.cs index 46e7f1d..c2700de 100644 --- a/GreadyPoang.EntityLayer/Enums/GamePointStatus.cs +++ b/GreadyPoang.EntityLayer/Enums/GamePointStatus.cs @@ -6,5 +6,6 @@ public enum GamePointStatus InProgress = 1, Completed = 2, Cancelled = 3, - Winning = 4 + Winning = 4, + Winner = 5 } diff --git a/GreadyPoang.EntityLayer/GreadyPoang.EntityLayer.csproj b/GreadyPoang.EntityLayer/GreadyPoang.EntityLayer.csproj index 167f71d..1e43643 100644 --- a/GreadyPoang.EntityLayer/GreadyPoang.EntityLayer.csproj +++ b/GreadyPoang.EntityLayer/GreadyPoang.EntityLayer.csproj @@ -1,7 +1,12 @@  - net9.0 + + net9.0-android; + net9.0-ios; + net9.0-maccatalyst; + net9.0-windows10.0.19041 + enable enable diff --git a/GreadyPoang.Migrations/GreadyPoang.Migrations.csproj b/GreadyPoang.Migrations/GreadyPoang.Migrations.csproj index d608574..de8abd4 100644 --- a/GreadyPoang.Migrations/GreadyPoang.Migrations.csproj +++ b/GreadyPoang.Migrations/GreadyPoang.Migrations.csproj @@ -2,7 +2,12 @@ Exe - net9.0 + + net9.0-android; + net9.0-ios; + net9.0-maccatalyst; + net9.0-windows10.0.19041 + enable enable diff --git a/GreadyPoang.Services/GreadyPoang.Services.csproj b/GreadyPoang.Services/GreadyPoang.Services.csproj index 56ac9b4..abe468e 100644 --- a/GreadyPoang.Services/GreadyPoang.Services.csproj +++ b/GreadyPoang.Services/GreadyPoang.Services.csproj @@ -1,7 +1,12 @@  - net9.0 + + net9.0-android; + net9.0-ios; + net9.0-maccatalyst; + net9.0-windows10.0.19041 + enable enable diff --git a/GreadyPoang.Services/Services/Implements/ObjectMessageService.cs b/GreadyPoang.Services/Services/Implements/ObjectMessageService.cs index 4b96d80..2a8fa18 100644 --- a/GreadyPoang.Services/Services/Implements/ObjectMessageService.cs +++ b/GreadyPoang.Services/Services/Implements/ObjectMessageService.cs @@ -4,6 +4,6 @@ namespace GreadyPoang.Services; public class ObjectMessageService : IObjectMessageService { - public RoundBuilderGroup CurrentGroup { get; set; } + public required RoundBuilderGroup CurrentGroup { get; set; } public bool Delivered { get; set; } = false; } diff --git a/GreadyPoang.ViewModelLayer/GreadyPoang.ViewModelLayer.csproj b/GreadyPoang.ViewModelLayer/GreadyPoang.ViewModelLayer.csproj index 4a57926..be0a6cc 100644 --- a/GreadyPoang.ViewModelLayer/GreadyPoang.ViewModelLayer.csproj +++ b/GreadyPoang.ViewModelLayer/GreadyPoang.ViewModelLayer.csproj @@ -1,7 +1,12 @@  - net9.0 + + net9.0-android; + net9.0-ios; + net9.0-maccatalyst; + net9.0-windows10.0.19041 + enable enable diff --git a/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs b/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs index d97209e..9ee4615 100644 --- a/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs +++ b/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs @@ -12,8 +12,8 @@ public class ParticipantViewModelCommands : ParticipantViewModel #region constructors public ParticipantViewModelCommands() : base() { - } + public ParticipantViewModelCommands( IRepository repo, IMethodSharingService sharingService, diff --git a/GreadyPoang/Resources/Styles/AppStyles.xaml b/GreadyPoang/Resources/Styles/AppStyles.xaml index 2a2c39d..809eca1 100644 --- a/GreadyPoang/Resources/Styles/AppStyles.xaml +++ b/GreadyPoang/Resources/Styles/AppStyles.xaml @@ -56,6 +56,9 @@ + + +