Tafflig lösning på sidbyte

This commit is contained in:
2025-10-04 10:05:15 +02:00
parent 11f0594233
commit a449dbeab3
4 changed files with 23 additions and 15 deletions

View File

@ -22,7 +22,8 @@ public class RoundStartingViewModel : ViewModelBase
ICombinedRepository combined,
IObjectMessageService objectMessage,
INavigationService nav,
IPageFactory factory) : base()
IPageFactory factory,
ISplashService splashService) : base()
{
_roundsRepo = roundsRepo;
_pointsRepo = pointsRepo;
@ -31,6 +32,7 @@ public class RoundStartingViewModel : ViewModelBase
_objectMessage = objectMessage;
_nav = nav;
_factory = factory;
_splashService = splashService;
_roundElements = new ObservableCollection<RoundBuilderElement>();
}
@ -46,6 +48,7 @@ public class RoundStartingViewModel : ViewModelBase
private readonly IObjectMessageService _objectMessage;
private readonly INavigationService _nav;
private readonly IPageFactory _factory;
private readonly ISplashService _splashService;
private Participant _selectedItem;
private ObservableCollection<RoundBuilderElement> _roundElements;
@ -238,16 +241,18 @@ public class RoundStartingViewModel : ViewModelBase
RoundElements.Clear();
}
public void RoundSelected(RoundBuilderElement element)
public async void RoundSelected(RoundBuilderElement element)
{
var rbGroup = GameRoundList.FirstOrDefault(g => g.GameRoundId == element.GameRoundId);
Debug.WriteLine($"Du valde raden med Runda {element.GameRoundId} och spelare: {element.ParticipantName}");
if (rbGroup != null)
{
_objectMessage.CurrentGroup = rbGroup;
//Shell.Current.GoToAsync("//RoundRunningPage");
var page = _factory.CreateRoundPage();
_nav.NavigateToPageAsync(page);
await _splashService.ShowSplash("Runda vald, gå till\r 'Påbörja eller fortsätt Runda'", 3000);
// await Shell.Current.GoToAsync("RoundRunning");
//var page = _factory.CreateRoundPage();
//await _nav.NavigateToPageAsync(page);
}
}

View File

@ -16,11 +16,14 @@
Title="Home" ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />
<ShellContent
Title="Deltagare" ContentTemplate="{DataTemplate pages:ParticipantListPage}"/>
Title="Deltagare" ContentTemplate="{DataTemplate pages:ParticipantListPage}"
Route="Deltagare"/>
<ShellContent
Title="Ny Runda" ContentTemplate="{DataTemplate pages:RoundStartingPage}"/>
Title="Ny Runda" ContentTemplate="{DataTemplate pages:RoundStartingPage}"
Route="RoundStart"/>
<ShellContent
Title="Påbörja eller fortsätt Runda" ContentTemplate="{DataTemplate pages:RoundRunningPage}"/>
Title="Påbörja eller fortsätt Runda" ContentTemplate="{DataTemplate pages:RoundRunningPage}"
Route="RoundRunning"/>
</TabBar>
<!--<viewsPartial:SplashView
x:Name="SplashViewControl"

View File

@ -1,6 +1,4 @@
using GreadyPoang.CommandClasses;
using GreadyPoang.Core;
using System.Text;
using GreadyPoang.Core;
namespace GreadyPoang
{
@ -12,9 +10,9 @@ namespace GreadyPoang
{
InitializeComponent();
Routing.RegisterRoute("Ny Runda", typeof(Pages.RoundStartingPage));
Routing.RegisterRoute("RoundStart", typeof(Pages.RoundStartingPage));
Routing.RegisterRoute("Deltagare", typeof(Pages.ParticipantListPage));
Routing.RegisterRoute("Påbörja eller fortsätt Runda", typeof(Pages.RoundRunningPage));
Routing.RegisterRoute("RoundRunning", typeof(Pages.RoundRunningPage));
_factory = factory;
}
}

View File

@ -21,14 +21,16 @@ public class RoundStartingViewModelCommands : RoundStartingViewModel
ICombinedRepository combined,
IObjectMessageService objectMessage,
INavigationService nav,
IPageFactory factory)
IPageFactory factory,
ISplashService splashService)
: base(roundsRepo,
pointsRepo,
sharingService,
combined,
objectMessage,
nav,
factory)
factory,
splashService)
{
}