Last active
March 10, 2017 18:35
-
-
Save ScottIsAFool/0e5e3c82426ba3a1eabee223de0e44fd to your computer and use it in GitHub Desktop.
Cimbalino Navigation for Xamarin.Forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is an example of the usage | |
private static INavigationService Navigation => SimpleIoc.Default.GetInstance<INavigationService>(); | |
public App(IContainer container) | |
{ | |
container.Create(); | |
SetNavigationHomePage(); | |
} | |
private void SetNavigationHomePage() | |
{ | |
Auth.AuthenticationChanged -= AuthOnAuthenticationChanged; | |
Auth.AuthenticationChanged += AuthOnAuthenticationChanged; | |
if (Auth.IsSignedIn) | |
{ | |
var masterDetailPage = new MasterDetailPage | |
{ | |
MasterBehavior = MasterBehavior.Popover, | |
Master = new MasterPage { Title = "needed" }, | |
Detail = new ExtendedNavigationPage(Navigation, new MainView()) | |
}; | |
MainPage = masterDetailPage; | |
} | |
else | |
{ | |
MainPage = new ExtendedNavigationPage(Navigation, new LoginView()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
using Cimbalino.Toolkit.Handlers; | |
using Cimbalino.Toolkit.Services; | |
using GalaSoft.MvvmLight; | |
namespace PkRun.ViewModels | |
{ | |
public abstract class BaseViewModel : ViewModelBase | |
{ | |
} | |
public abstract class PageBaseViewModel : BaseViewModel, IHandleNavigatedTo, IHandleNavigatedFrom | |
{ | |
public virtual Task OnNavigatedToAsync(NavigationServiceNavigationEventArgs eventArgs) | |
{ | |
return Task.FromResult(0); | |
} | |
public virtual Task OnNavigatedFromAsync(NavigationServiceNavigationEventArgs eventArgs) | |
{ | |
return Task.FromResult(0); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Xamarin.Forms; | |
namespace PkRun.Views | |
{ | |
public class PageBase : ContentPage | |
{ | |
public object NavigationParameter { get; private set; } | |
public void SetNavigationParameter(object parameter) | |
{ | |
NavigationParameter = parameter; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment