diff --git a/Example.cs b/Example.cs new file mode 100644 index 0000000..e69de29 diff --git a/GreadyPoang.Services/Services/Implements/ObjectMessageService.cs b/GreadyPoang.Services/Services/Implements/ObjectMessageService.cs index 90cef68..4b96d80 100644 --- a/GreadyPoang.Services/Services/Implements/ObjectMessageService.cs +++ b/GreadyPoang.Services/Services/Implements/ObjectMessageService.cs @@ -5,5 +5,5 @@ namespace GreadyPoang.Services; public class ObjectMessageService : IObjectMessageService { public RoundBuilderGroup CurrentGroup { get; set; } - public bool Delivered { get; set; } + public bool Delivered { get; set; } = false; } diff --git a/GreadyPoang.ViewModelLayer/ViewModelClasses/MainPageViewModel.cs b/GreadyPoang.ViewModelLayer/ViewModelClasses/MainPageViewModel.cs new file mode 100644 index 0000000..1656052 --- /dev/null +++ b/GreadyPoang.ViewModelLayer/ViewModelClasses/MainPageViewModel.cs @@ -0,0 +1,30 @@ +using Common.Library; +using GreadyPoang.Services; + +namespace GreadyPoang.ViewModelLayer; + +public class MainPageViewModel : ViewModelBase +{ + private readonly AppShellViewModel _appShell; + private readonly IObjectMessageService _messageService; + + public MainPageViewModel( + AppShellViewModel appShell, + IObjectMessageService messageService + ) : base() + { + + _appShell = appShell; + _messageService = messageService; + + } + + public void InitMessage() + { + if (_appShell.RoundRunningVisible == false) + { + _messageService.Delivered = true; + } + } + +} diff --git a/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs b/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs index 39f80d1..06105cd 100644 --- a/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs +++ b/GreadyPoang.ViewModelLayer/ViewModelClasses/ParticipantViewModel.cs @@ -1,5 +1,6 @@ using Common.Library; using GreadyPoang.EntityLayer; +using GreadyPoang.Services; using System.Collections.ObjectModel; @@ -13,10 +14,16 @@ public class ParticipantViewModel : ViewModelBase } - public ParticipantViewModel(IRepository repo, IMethodSharingService sharingService) : base() + public ParticipantViewModel( + IRepository repo, + IMethodSharingService sharingService, + AppShellViewModel appShell, + IObjectMessageService objectMessage) : base() { _Repository = repo; _sharingService = sharingService; + _appShell = appShell; + _objectMessage = objectMessage; } #endregion @@ -26,6 +33,8 @@ public class ParticipantViewModel : ViewModelBase private ObservableCollection _ParticipantList = new(); private readonly IRepository? _Repository; private readonly IMethodSharingService _sharingService; + private readonly AppShellViewModel _appShell; + private readonly IObjectMessageService _objectMessage; #endregion #region public Properties @@ -55,6 +64,10 @@ public class ParticipantViewModel : ViewModelBase #region Get Method public ObservableCollection Get() { + if (_appShell.RoundRunningVisible == false) + { + _objectMessage.Delivered = true; + } ParticipantList = _sharingService.Get(); return ParticipantList; } diff --git a/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundRunningViewModel.cs b/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundRunningViewModel.cs index 7277022..08099ef 100644 --- a/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundRunningViewModel.cs +++ b/GreadyPoang.ViewModelLayer/ViewModelClasses/RoundRunningViewModel.cs @@ -62,6 +62,7 @@ public class RoundRunningViewModel : ViewModelBase RebuildRequested?.Invoke(this, EventArgs.Empty); } + // Översta raden public ObservableCollection RoundElements { get { return _roundElements; } @@ -72,6 +73,7 @@ public class RoundRunningViewModel : ViewModelBase } } + // Nedersta strukturen public Collection PlayerColumns { get { return _playerColumns; } @@ -122,7 +124,7 @@ public class RoundRunningViewModel : ViewModelBase } foreach (var item in _objectMessage.CurrentGroup.Elements) { - _roundElements.Add(item); + RoundElements.Add(item); } // Räkna ut vem som är nästa spelare @@ -138,6 +140,10 @@ public class RoundRunningViewModel : ViewModelBase var localElements = _combined.roundBuilderElementsTotalById(_objectMessage.CurrentGroup.GameRoundId); FillupResultTable(localElements); + foreach (var col in _playerColumns) + { + RoundElements.FirstOrDefault(e => e.ParticipantId == col.PlayerId).GameRegPoints = col.PlayerPoints; + } TriggerRebuild(); } return RoundElements; @@ -206,8 +212,6 @@ public class RoundRunningViewModel : ViewModelBase return -1; } - - private void FillupResultTable(IEnumerable elements) { if (_playerColumns != null) diff --git a/GreadyPoang/App.xaml.cs b/GreadyPoang/App.xaml.cs index 31c9041..ee69b7e 100644 --- a/GreadyPoang/App.xaml.cs +++ b/GreadyPoang/App.xaml.cs @@ -1,4 +1,5 @@ using GreadyPoang.DataLayer.Database; +using System.Diagnostics; namespace GreadyPoang; @@ -11,6 +12,18 @@ public partial class App : Application InitializeComponent(); dataContext.Database.EnsureCreated(); _services = services; + + AppDomain.CurrentDomain.UnhandledException += (sender, e) => + { + if (Debugger.IsAttached) + Debugger.Break(); + }; + + TaskScheduler.UnobservedTaskException += (sender, e) => + { + if (Debugger.IsAttached) + Debugger.Break(); + }; } protected override Window CreateWindow(IActivationState? activationState) diff --git a/GreadyPoang/CommandClasses/MainPageViewModelCommands.cs b/GreadyPoang/CommandClasses/MainPageViewModelCommands.cs new file mode 100644 index 0000000..c295f5b --- /dev/null +++ b/GreadyPoang/CommandClasses/MainPageViewModelCommands.cs @@ -0,0 +1,15 @@ +using GreadyPoang.Services; +using GreadyPoang.ViewModelLayer; + +namespace GreadyPoang.CommandClasses; + +public class MainPageViewModelCommands : MainPageViewModel +{ + public MainPageViewModelCommands( + AppShellViewModel appShell, + IObjectMessageService messageService + ) : base(appShell, messageService) + { + + } +} diff --git a/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs b/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs index 9000827..d97209e 100644 --- a/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs +++ b/GreadyPoang/CommandClasses/ParticipantViewModelCommands.cs @@ -1,5 +1,6 @@ using Common.Library; using GreadyPoang.EntityLayer; +using GreadyPoang.Services; using GreadyPoang.ViewModelLayer; using System.Windows.Input; @@ -13,7 +14,11 @@ public class ParticipantViewModelCommands : ParticipantViewModel { } - public ParticipantViewModelCommands(IRepository repo, IMethodSharingService sharingService) : base(repo, sharingService) + public ParticipantViewModelCommands( + IRepository repo, + IMethodSharingService sharingService, + AppShellViewModel appShell, + IObjectMessageService objectMessage) : base(repo, sharingService, appShell, objectMessage) { } diff --git a/GreadyPoang/CommandClasses/RoundRunningViewModelCommands.cs b/GreadyPoang/CommandClasses/RoundRunningViewModelCommands.cs index 59348dd..d16ec5e 100644 --- a/GreadyPoang/CommandClasses/RoundRunningViewModelCommands.cs +++ b/GreadyPoang/CommandClasses/RoundRunningViewModelCommands.cs @@ -57,7 +57,7 @@ public class RoundRunningViewModelCommands : RoundRunningViewModel { base.StoreAndHandlePoints(); //await Shell.Current.GoToAsync(".."); - await Shell.Current.GoToAsync("Påbörja eller fortsätt Runda"); + // await Shell.Current.GoToAsync("RoundRunningPage"); } private async Task ToggleSplash() diff --git a/GreadyPoang/MainPage.xaml b/GreadyPoang/MainPage.xaml index f79371a..a9ffb2f 100644 --- a/GreadyPoang/MainPage.xaml +++ b/GreadyPoang/MainPage.xaml @@ -3,6 +3,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:partial="clr-namespace:GreadyPoang.ViewsPartial" x:Class="GreadyPoang.MainPage" + xmlns:vm ="clr-namespace:GreadyPoang.CommandClasses" + x:DataType="vm:MainPageViewModelCommands" Background="LightCyan" Title="{StaticResource ApplicationTitle}"> @@ -12,7 +14,8 @@ ViewDescription="Välkommen till Gready"> - (); builder.Services.AddSingleton(); + builder.Services.AddSingleton(); #if DEBUG diff --git a/GreadyPoang/Views/RoundRunningView.xaml b/GreadyPoang/Views/RoundRunningView.xaml index 52d0858..a02cc12 100644 --- a/GreadyPoang/Views/RoundRunningView.xaml +++ b/GreadyPoang/Views/RoundRunningView.xaml @@ -83,13 +83,16 @@