Nu fungerar hanteringen kring navigation
This commit is contained in:
@ -0,0 +1,21 @@
|
||||
using Common.Library;
|
||||
|
||||
namespace GreadyPoang.ViewModelLayer;
|
||||
|
||||
public class AppShellViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
private bool _roundRounningVisible = true;
|
||||
|
||||
public bool RoundRunningVisible
|
||||
{
|
||||
get { return _roundRounningVisible; }
|
||||
set
|
||||
{
|
||||
_roundRounningVisible = value;
|
||||
RaisePropertyChanged(nameof(RoundRunningVisible));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -24,7 +24,8 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
IMethodSharingService<Participant> sharingService,
|
||||
ICombinedRepository combined,
|
||||
IObjectMessageService objectMessage,
|
||||
ISplashService splashService
|
||||
ISplashService splashService,
|
||||
AppShellViewModel appShell
|
||||
) : base()
|
||||
{
|
||||
_roundsRepo = roundsRepo;
|
||||
@ -33,6 +34,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
_combined = combined;
|
||||
_objectMessage = objectMessage;
|
||||
_splashService = splashService;
|
||||
_appShell = appShell;
|
||||
_roundElements = new ObservableCollection<RoundBuilderElement>();
|
||||
_builderObject = new();
|
||||
_SplashShowing = false;
|
||||
@ -47,6 +49,7 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
private readonly ICombinedRepository _combined;
|
||||
private readonly IObjectMessageService _objectMessage;
|
||||
private readonly ISplashService _splashService;
|
||||
private readonly AppShellViewModel _appShell;
|
||||
private ObservableCollection<RoundBuilderGroup> _GameRoundList = new();
|
||||
private ObservableCollection<Participant> _ParticipantList = new();
|
||||
private ObservableCollection<RoundBuilderElement> _roundElements;
|
||||
@ -89,6 +92,18 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
private bool _gobackVisible = true;
|
||||
|
||||
public bool GobackVisible
|
||||
{
|
||||
get { return _gobackVisible; }
|
||||
set
|
||||
{
|
||||
_gobackVisible = value;
|
||||
RaisePropertyChanged(nameof(GobackVisible));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ObservableCollection<RoundBuilderElement> Get()
|
||||
{
|
||||
@ -97,6 +112,8 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
|
||||
if (_objectMessage.CurrentGroup != null)
|
||||
{
|
||||
GobackVisible = _objectMessage.Delivered;
|
||||
_objectMessage.Delivered = false;
|
||||
//CurrentGroup är satt från RoundStarting ViewModel
|
||||
Debug.WriteLine($"Chosen round: {_objectMessage.CurrentGroup.GameRoundId}");
|
||||
if (RoundElements.Count > 0)
|
||||
@ -271,6 +288,11 @@ public class RoundRunningViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void GobackAsync()
|
||||
{
|
||||
_appShell.RoundRunningVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -23,7 +23,9 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
IObjectMessageService objectMessage,
|
||||
INavigationService nav,
|
||||
IPageFactory factory,
|
||||
ISplashService splashService) : base()
|
||||
ISplashService splashService,
|
||||
AppShellViewModel appShellView
|
||||
) : base()
|
||||
{
|
||||
_roundsRepo = roundsRepo;
|
||||
_pointsRepo = pointsRepo;
|
||||
@ -33,6 +35,7 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
_nav = nav;
|
||||
_factory = factory;
|
||||
_splashService = splashService;
|
||||
_appShellView = appShellView;
|
||||
_roundElements = new ObservableCollection<RoundBuilderElement>();
|
||||
}
|
||||
|
||||
@ -49,6 +52,7 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
private readonly INavigationService _nav;
|
||||
private readonly IPageFactory _factory;
|
||||
private readonly ISplashService _splashService;
|
||||
private readonly AppShellViewModel _appShellView;
|
||||
private Participant _selectedItem;
|
||||
|
||||
private ObservableCollection<RoundBuilderElement> _roundElements;
|
||||
@ -248,11 +252,14 @@ public class RoundStartingViewModel : ViewModelBase
|
||||
if (rbGroup != null)
|
||||
{
|
||||
_objectMessage.CurrentGroup = rbGroup;
|
||||
await _splashService.ShowSplash("Runda vald, gå till\r 'Påbörja eller fortsätt Runda'", 3000);
|
||||
// await Shell.Current.GoToAsync("RoundRunning");
|
||||
_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");
|
||||
|
||||
_appShellView.RoundRunningVisible = false;
|
||||
//_roundRunning.GobackVisible = false;
|
||||
//var page = _factory.CreateRoundPage();
|
||||
//await _nav.NavigateToPageAsync(page);
|
||||
//_nav.NavigateToPageAsync(page);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user