Misslyckat läge , men sparas
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
using Common.Library;
|
||||
using Gready_Poang.Core;
|
||||
using Gready_Poang.DataLayer;
|
||||
using Gready_Poang.EntityLayer;
|
||||
using Gready_Poang.Services;
|
||||
@ -21,9 +20,9 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
ICombinedRepository combined,
|
||||
IObjectMessageService objectMessage,
|
||||
INavigationService nav,
|
||||
IPageFactory factory,
|
||||
ISplashService splashService,
|
||||
//INavigationService nav,
|
||||
//IPageFactory factory,
|
||||
//ISplashService splashService,
|
||||
AppShellViewModel appShellView
|
||||
) : base()
|
||||
{
|
||||
@ -32,9 +31,9 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
_sharingService = sharingService;
|
||||
_combined = combined;
|
||||
_objectMessage = objectMessage;
|
||||
_nav = nav;
|
||||
_factory = factory;
|
||||
_splashService = splashService;
|
||||
//_nav = nav;
|
||||
//_factory = factory;
|
||||
//_splashService = splashService;
|
||||
_appShellView = appShellView;
|
||||
_roundElements = new ObservableCollection<RoundBuilderElement>();
|
||||
}
|
||||
@ -49,9 +48,9 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
private readonly IMethodSharingService<Participant> _sharingService;
|
||||
private readonly ICombinedRepository _combined;
|
||||
private readonly IObjectMessageService _objectMessage;
|
||||
private readonly INavigationService _nav;
|
||||
private readonly IPageFactory _factory;
|
||||
private readonly ISplashService _splashService;
|
||||
//private readonly INavigationService _nav;
|
||||
//private readonly IPageFactory _factory;
|
||||
//private readonly ISplashService _splashService;
|
||||
private readonly AppShellViewModel _appShellView;
|
||||
private Participant _selectedItem;
|
||||
|
||||
@ -253,13 +252,10 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
{
|
||||
_objectMessage.CurrentGroup = rbGroup;
|
||||
_objectMessage.Delivered = true;
|
||||
//await _splashService.ShowSplash("Runda vald, gå till\r\r 'Påbörja eller fortsätt Runda'", 3000);
|
||||
await Shell.Current.GoToAsync("RoundRunningPage");
|
||||
await Shell.Current.GoToAsync("RoundRunningView");
|
||||
|
||||
_appShellView.RoundRunningVisible = false;
|
||||
//_roundRunning.GobackVisible = false;
|
||||
//var page = _factory.CreateRoundPage();
|
||||
//_nav.NavigateToPageAsync(page);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,17 +1,21 @@
|
||||
using Gready_Poang.DataLayer.Database;
|
||||
using Gready_Poang.ViewModelLayer;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Gready_Poang;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
private readonly IServiceProvider _services;
|
||||
private readonly AppShellViewModel _shellViewModel;
|
||||
|
||||
public App(IServiceProvider services, DataContext dataContext)
|
||||
//private readonly IServiceProvider _services;
|
||||
|
||||
//public App(IServiceProvider services, DataContext dataContext)
|
||||
public App(DataContext dataContext, AppShellViewModel shellViewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
dataContext.Database.EnsureCreated();
|
||||
_services = services;
|
||||
//_services = services;
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
|
||||
{
|
||||
@ -24,15 +28,13 @@ public partial class App : Application
|
||||
if (Debugger.IsAttached)
|
||||
Debugger.Break();
|
||||
};
|
||||
_shellViewModel = shellViewModel;
|
||||
}
|
||||
|
||||
protected override Window CreateWindow(IActivationState? activationState)
|
||||
{
|
||||
|
||||
//var splashVm = ServiceLocator.Services.GetRequiredService<SplashViewModelCommands>();
|
||||
//var shell = new AppShell(splashVm);
|
||||
|
||||
var shell = _services.GetRequiredService<AppShell>();
|
||||
return new Window(shell);
|
||||
//var shell = _services.GetRequiredService<AppShell>();
|
||||
//return new Window(shell);
|
||||
return new Window(new AppShell(_shellViewModel));
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,6 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:vm ="clr-namespace:Gready_Poang.ViewModelLayer;assembly=Gready_Poang.ViewModelLayer"
|
||||
xmlns:views="clr-namespace:Gready_Poang.Views"
|
||||
xmlns:pages="clr-namespace:Gready_Poang.Pages"
|
||||
xmlns:local="clr-namespace:Gready_Poang"
|
||||
Title="Gready_Poang"
|
||||
Shell.TitleColor="LightYellow"
|
||||
@ -17,13 +16,13 @@
|
||||
Title="Home" ContentTemplate="{DataTemplate local:MainPage}"
|
||||
Route="MainPage" />
|
||||
<ShellContent
|
||||
Title="Deltagare" ContentTemplate="{DataTemplate pages:ParticipantListPage}"
|
||||
Title="Deltagare" ContentTemplate="{DataTemplate views:ParticipantListView}"
|
||||
Route="ParticipantListPage"/>
|
||||
<ShellContent
|
||||
Title="Ny Runda" ContentTemplate="{DataTemplate pages:RoundStartingPage}"
|
||||
Title="Ny Runda" ContentTemplate="{DataTemplate views:RoundStartingView}"
|
||||
Route="RoundStartingPage"/>
|
||||
<ShellContent
|
||||
Title="Påbörja eller fortsätt Runda" ContentTemplate="{DataTemplate pages:RoundRunningPage}"
|
||||
Title="Påbörja eller fortsätt Runda" ContentTemplate="{DataTemplate views:RoundRunningView}"
|
||||
Route="RoundRunningPage" IsVisible="{Binding RoundRunningVisible}"/>
|
||||
</TabBar>
|
||||
|
||||
|
||||
@ -1,20 +1,19 @@
|
||||
using Gready_Poang.Core;
|
||||
using Gready_Poang.ViewModelLayer;
|
||||
using Gready_Poang.ViewModelLayer;
|
||||
|
||||
namespace Gready_Poang
|
||||
{
|
||||
public partial class AppShell : Shell
|
||||
{
|
||||
private readonly IPageFactory _factory;
|
||||
//private readonly IPageFactory _factory;
|
||||
|
||||
public AppShell(IPageFactory factory, AppShellViewModel appShellView)
|
||||
//public AppShell(IPageFactory factory, AppShellViewModel appShellView)
|
||||
public AppShell(AppShellViewModel appShellView)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Routing.RegisterRoute("RoundStartingPage", typeof(Pages.RoundStartingPage));
|
||||
Routing.RegisterRoute("ParticipantListPage", typeof(Pages.ParticipantListPage));
|
||||
Routing.RegisterRoute("RoundRunningPage", typeof(Pages.RoundRunningPage));
|
||||
_factory = factory;
|
||||
Routing.RegisterRoute("ParticipantListView", typeof(Views.ParticipantListView));
|
||||
Routing.RegisterRoute("RoundStartingView", typeof(Views.RoundStartingView));
|
||||
Routing.RegisterRoute("RoundRunningView", typeof(Views.RoundRunningView));
|
||||
//_factory = factory;
|
||||
BindingContext = appShellView;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using Common.Library;
|
||||
using Gready_Poang.Core;
|
||||
using Gready_Poang.DataLayer;
|
||||
using Gready_Poang.EntityLayer;
|
||||
using Gready_Poang.Services;
|
||||
@ -20,18 +19,18 @@ public class RoundStartingViewModelCommands : RoundStartingViewModel
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
ICombinedRepository combined,
|
||||
IObjectMessageService objectMessage,
|
||||
INavigationService nav,
|
||||
IPageFactory factory,
|
||||
ISplashService splashService,
|
||||
//INavigationService nav,
|
||||
//IPageFactory factory,
|
||||
//ISplashService splashService,
|
||||
AppShellViewModel appShell)
|
||||
: base(roundsRepo,
|
||||
pointsRepo,
|
||||
sharingService,
|
||||
combined,
|
||||
objectMessage,
|
||||
nav,
|
||||
factory,
|
||||
splashService,
|
||||
//nav,
|
||||
//factory,
|
||||
//splashService,
|
||||
appShell)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
using Gready_Poang.CommandClasses;
|
||||
using Gready_Poang.Core;
|
||||
using Gready_Poang.Pages;
|
||||
using Gready_Poang.Core;
|
||||
|
||||
namespace Gready_Poang;
|
||||
|
||||
@ -15,9 +13,9 @@ public class PageFactory : IPageFactory
|
||||
|
||||
public Page CreateRoundPage()
|
||||
{
|
||||
var vm = _services.GetRequiredService<RoundRunningViewModelCommands>();
|
||||
var splashVm = _services.GetRequiredService<SplashViewModelCommands>();
|
||||
return new RoundRunningPage(vm, splashVm);
|
||||
//var vm = _services.GetRequiredService<RoundRunningViewModelCommands>();
|
||||
//return new RoundRunningView(vm);
|
||||
return null;
|
||||
}
|
||||
|
||||
//public Page CreateStatsPage()
|
||||
|
||||
@ -59,6 +59,14 @@
|
||||
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="BasePage.xaml.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MauiXaml Remove="BasePage.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.100" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
|
||||
@ -81,9 +89,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MauiXaml Update="BasePage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
<MauiXaml Update="Resources\Styles\AppStyles.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
|
||||
@ -41,7 +41,7 @@ public static class MauiProgram
|
||||
options.UseSqlite($"Data Source={dbPath}");
|
||||
});
|
||||
|
||||
builder.Services.AddScoped<IPageFactory, PageFactory>();
|
||||
// builder.Services.AddScoped<IPageFactory, PageFactory>();
|
||||
builder.Services.AddSingleton<INavigationService, NavigationService>();
|
||||
builder.Services.AddSingleton<IServiceLocator, ServiceLocator>();
|
||||
|
||||
@ -74,8 +74,9 @@ public static class MauiProgram
|
||||
#if DEBUG
|
||||
builder.Logging.AddDebug();
|
||||
#endif
|
||||
var app = builder.Build();
|
||||
ServiceLocator.Services = app.Services;
|
||||
return app;
|
||||
//var app = builder.Build();
|
||||
//ServiceLocator.Services = app.Services;
|
||||
//return app;
|
||||
return builder.Build();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
using Gready_Poang.CommandClasses;
|
||||
using Gready_Poang.Views;
|
||||
|
||||
namespace Gready_Poang.Pages;
|
||||
|
||||
public class ParticipantListPage : BasePage
|
||||
{
|
||||
private readonly ParticipantViewModelCommands _vm;
|
||||
|
||||
public ParticipantListPage(ParticipantViewModelCommands vm, SplashViewModelCommands splashVm)
|
||||
: base(new ParticipantListView(vm), splashVm)
|
||||
{
|
||||
Title = "Deltagar Lista";
|
||||
_vm = vm;
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = _vm;
|
||||
_vm.Get();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
using Gready_Poang.CommandClasses;
|
||||
using Gready_Poang.Core;
|
||||
using Gready_Poang.Views;
|
||||
|
||||
namespace Gready_Poang.Pages;
|
||||
|
||||
public class RoundRunningPage : BasePage
|
||||
{
|
||||
private readonly RoundRunningViewModelCommands _vm;
|
||||
private readonly SplashViewModelCommands _splashVm;
|
||||
public ISplashService Splash { get; set; }
|
||||
|
||||
public RoundRunningPage(RoundRunningViewModelCommands Vm, SplashViewModelCommands splashVm)
|
||||
: base(new RoundRunningView(Vm), splashVm)
|
||||
{
|
||||
Title = "Starta/Fortsätt runda";
|
||||
_vm = Vm;
|
||||
Splash = ServiceLocator.Services?.GetRequiredService<ISplashService>();
|
||||
_splashVm = splashVm;
|
||||
}
|
||||
|
||||
|
||||
public SplashViewModelCommands SplashVm { get; }
|
||||
|
||||
protected override async void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = _vm;
|
||||
_vm.Get();
|
||||
//BuildScoreGrid(ViewModel.PlayerColumns); // <-- här bygger du layouten
|
||||
//// _vm.RebuildRequested += ViewModel_RebuildRequested;
|
||||
if (_splashVm != null)
|
||||
{
|
||||
await Splash.ShowSplash("Nu kan du spela vidare", 3000);
|
||||
//await Splash.ShowSplash("Nu kan du spela vidare", 3000).GetAwaiter().GetResult();
|
||||
}
|
||||
//_splashVm.ShowSplash("Nu kan du spela vidare").GetAwaiter().GetResult(); ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
using Gready_Poang.CommandClasses;
|
||||
using Gready_Poang.Views;
|
||||
|
||||
namespace Gready_Poang.Pages;
|
||||
|
||||
public class RoundStartingPage : BasePage
|
||||
{
|
||||
private readonly RoundStartingViewModelCommands _vm;
|
||||
|
||||
public RoundStartingPage(RoundStartingViewModelCommands vm, SplashViewModelCommands splashVm)
|
||||
: base(new RoundStartingView(vm), splashVm)
|
||||
{
|
||||
Title = "Starta ny Runda";
|
||||
_vm = vm;
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = _vm;
|
||||
_vm.Get();
|
||||
_vm.GetParticipants();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:partial="clr-namespace:Gready_Poang.ViewsPartial"
|
||||
xmlns:vm="clr-namespace:Gready_Poang.CommandClasses"
|
||||
xmlns:model="clr-namespace:Gready_Poang.EntityLayer;assembly=Gready_Poang.EntityLayer"
|
||||
x:Class="Gready_Poang.Views.ParticipantListView"
|
||||
x:DataType="vm:ParticipantViewModelCommands"
|
||||
x:Name="ParticipantListPage">
|
||||
<!--Title="Deltagar Lista"-->
|
||||
x:Name="ParticipantListPage"
|
||||
Title="Deltagar Lista">
|
||||
|
||||
<Border Style="{StaticResource Border.Page}" StrokeThickness="4">
|
||||
<Grid Style="{StaticResource Grid.Page}">
|
||||
@ -86,4 +86,4 @@
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentView>
|
||||
</ContentPage>
|
||||
@ -2,23 +2,28 @@ using Gready_Poang.CommandClasses;
|
||||
|
||||
namespace Gready_Poang.Views;
|
||||
|
||||
public partial class ParticipantListView : ContentView
|
||||
public partial class ParticipantListView : ContentPage
|
||||
{
|
||||
|
||||
private readonly ParticipantViewModelCommands _vm;
|
||||
|
||||
public ParticipantListView(ParticipantViewModelCommands viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = viewModel;
|
||||
_vm = viewModel;
|
||||
|
||||
}
|
||||
|
||||
public ParticipantViewModelCommands ViewModel { get; set; }
|
||||
public int ParticipantId { get; set; }
|
||||
|
||||
//protected override void OnAppearing()
|
||||
//{
|
||||
// base.OnAppearing();
|
||||
// BindingContext = ViewModel;
|
||||
// ViewModel.Get();
|
||||
//}
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = ViewModel;
|
||||
ViewModel.Get();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:partial="clr-namespace:Gready_Poang.ViewsPartial"
|
||||
x:Class="Gready_Poang.Views.RoundRunningView"
|
||||
xmlns:vm ="clr-namespace:Gready_Poang.CommandClasses"
|
||||
xmlns:vm="clr-namespace:Gready_Poang.CommandClasses"
|
||||
xmlns:behaviors="clr-namespace:Gready_Poang.Common;assembly=Gready_Poang.Common"
|
||||
xmlns:local="clr-namespace:Gready_Poang.EntityLayer;assembly=Gready_Poang.EntityLayer"
|
||||
xmlns:model="clr-namespace:Gready_Poang.EntityLayer;assembly=Gready_Poang.EntityLayer"
|
||||
x:DataType="vm:RoundRunningViewModelCommands">
|
||||
<!--Title="RoundRunningView"-->
|
||||
Title = "Starta/Fortsätt runda">
|
||||
|
||||
<Border Style="{StaticResource Border.Page}" StrokeThickness="4">
|
||||
<Grid Style="{StaticResource Grid.Page}">
|
||||
@ -112,4 +111,4 @@
|
||||
</ScrollView>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentView>
|
||||
</ContentPage>
|
||||
@ -3,7 +3,7 @@ using Gready_Poang.EntityLayer;
|
||||
|
||||
namespace Gready_Poang.Views;
|
||||
|
||||
public partial class RoundRunningView : ContentView
|
||||
public partial class RoundRunningView : ContentPage
|
||||
{
|
||||
|
||||
public RoundRunningView(RoundRunningViewModelCommands viewModel)
|
||||
@ -13,7 +13,16 @@ public partial class RoundRunningView : ContentView
|
||||
ViewModel.RebuildRequested += ViewModel_RebuildRequested;
|
||||
}
|
||||
|
||||
protected override async void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = ViewModel;
|
||||
ViewModel.Get();
|
||||
//BuildScoreGrid(ViewModel.PlayerColumns); // <-- h<>r bygger du layouten
|
||||
//// _vm.RebuildRequested += ViewModel_RebuildRequested;
|
||||
//_splashVm.ShowSplash("Nu kan du spela vidare").GetAwaiter().GetResult(); ;
|
||||
|
||||
}
|
||||
private void ViewModel_RebuildRequested(object? sender, EventArgs e)
|
||||
{
|
||||
BuildScoreGrid(ViewModel.PlayerColumns); // <-- h<>r bygger du layouten
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:partial="clr-namespace:Gready_Poang.ViewsPartial"
|
||||
x:Class="Gready_Poang.Views.RoundStartingView"
|
||||
@ -151,4 +151,4 @@
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ContentView>
|
||||
</ContentPage>
|
||||
@ -2,7 +2,7 @@ using Gready_Poang.CommandClasses;
|
||||
|
||||
namespace Gready_Poang.Views;
|
||||
|
||||
public partial class RoundStartingView : ContentView
|
||||
public partial class RoundStartingView : ContentPage
|
||||
{
|
||||
|
||||
|
||||
@ -15,13 +15,13 @@ public partial class RoundStartingView : ContentView
|
||||
|
||||
public int GameRoundId { get; set; }
|
||||
|
||||
//protected override void OnAppearing()
|
||||
//{
|
||||
// base.OnAppearing();
|
||||
// BindingContext = ViewModel;
|
||||
// ViewModel.Get();
|
||||
// ViewModel.GetParticipants();
|
||||
//}
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = ViewModel;
|
||||
ViewModel.Get();
|
||||
ViewModel.GetParticipants();
|
||||
}
|
||||
|
||||
protected override void OnSizeAllocated(double width, double height)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user