Uppdelningsläge
This commit is contained in:
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
public class BehaviorBase<T> : Behavior<T> 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<T> : Behavior<T> where T : BindableObject
|
||||
AssociatedObject = null;
|
||||
}
|
||||
|
||||
void OnBindingContextChanged(object sender, EventArgs e)
|
||||
void OnBindingContextChanged(object? sender, EventArgs e)
|
||||
{
|
||||
if (AssociatedObject != null)
|
||||
BindingContext = AssociatedObject.BindingContext;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -2,21 +2,27 @@
|
||||
|
||||
namespace GreadyPoang.Common;
|
||||
|
||||
public class DigitsOnlyBehavior : Behavior<Entry>
|
||||
public class DigitsOnlyBehavior : Behavior<Entry?>
|
||||
{
|
||||
protected override void OnAttachedTo(Entry entry)
|
||||
protected override void OnAttachedTo(Entry? entry)
|
||||
{
|
||||
if (entry != null)
|
||||
{
|
||||
entry.TextChanged += OnTextChanged;
|
||||
}
|
||||
base.OnAttachedTo(entry);
|
||||
}
|
||||
|
||||
protected override void OnDetachingFrom(Entry entry)
|
||||
protected override void OnDetachingFrom(Entry? entry)
|
||||
{
|
||||
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;
|
||||
|
||||
@ -4,7 +4,7 @@ using System.Windows.Input;
|
||||
namespace GreadyPoang.Common;
|
||||
public class EventToCommandBehavior : BehaviorBase<VisualElement>
|
||||
{
|
||||
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<VisualElement>
|
||||
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<VisualElement>
|
||||
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)
|
||||
|
||||
@ -74,7 +74,7 @@ public class CombinedRepository : ICombinedRepository
|
||||
public IEnumerable<RoundBuilderElement> roundBuilderElementsDbById(int GameId)
|
||||
{
|
||||
var result = _context.RoundBuilderElements
|
||||
.FromSqlRaw($@"
|
||||
.FromSql($@"
|
||||
SELECT
|
||||
gp.GamePointId,
|
||||
gp.GameRoundId,
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -6,5 +6,6 @@ public enum GamePointStatus
|
||||
InProgress = 1,
|
||||
Completed = 2,
|
||||
Cancelled = 3,
|
||||
Winning = 4
|
||||
Winning = 4,
|
||||
Winner = 5
|
||||
}
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -2,7 +2,12 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFrameworks>
|
||||
net9.0-android;
|
||||
net9.0-ios;
|
||||
net9.0-maccatalyst;
|
||||
net9.0-windows10.0.19041
|
||||
</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -12,8 +12,8 @@ public class ParticipantViewModelCommands : ParticipantViewModel
|
||||
#region constructors
|
||||
public ParticipantViewModelCommands() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ParticipantViewModelCommands(
|
||||
IRepository<Participant> repo,
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
|
||||
@ -56,6 +56,9 @@
|
||||
<Setter Property="BackgroundColor" Value="LightCoral" />
|
||||
</DataTrigger>
|
||||
<DataTrigger TargetType="Border" Binding="{Binding Status}" Value="Winning">
|
||||
<Setter Property="BackgroundColor" Value="Yellow" />
|
||||
</DataTrigger>
|
||||
<DataTrigger TargetType="Border" Binding="{Binding Status}" Value="Winner">
|
||||
<Setter Property="BackgroundColor" Value="Red" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
|
||||
Reference in New Issue
Block a user