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

View File

@ -16,11 +16,14 @@
Title="Home" ContentTemplate="{DataTemplate local:MainPage}" Title="Home" ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" /> Route="MainPage" />
<ShellContent <ShellContent
Title="Deltagare" ContentTemplate="{DataTemplate pages:ParticipantListPage}"/> Title="Deltagare" ContentTemplate="{DataTemplate pages:ParticipantListPage}"
Route="Deltagare"/>
<ShellContent <ShellContent
Title="Ny Runda" ContentTemplate="{DataTemplate pages:RoundStartingPage}"/> Title="Ny Runda" ContentTemplate="{DataTemplate pages:RoundStartingPage}"
Route="RoundStart"/>
<ShellContent <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> </TabBar>
<!--<viewsPartial:SplashView <!--<viewsPartial:SplashView
x:Name="SplashViewControl" x:Name="SplashViewControl"

View File

@ -1,6 +1,4 @@
using GreadyPoang.CommandClasses; using GreadyPoang.Core;
using GreadyPoang.Core;
using System.Text;
namespace GreadyPoang namespace GreadyPoang
{ {
@ -12,9 +10,9 @@ namespace GreadyPoang
{ {
InitializeComponent(); InitializeComponent();
Routing.RegisterRoute("Ny Runda", typeof(Pages.RoundStartingPage)); Routing.RegisterRoute("RoundStart", typeof(Pages.RoundStartingPage));
Routing.RegisterRoute("Deltagare", typeof(Pages.ParticipantListPage)); 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; _factory = factory;
} }
} }

View File

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