Mobile/CafeLib.Mobile/Extensions/ApplicationExtensions.cs
/// <summary>
/// Start application on view model.
/// </summary>
/// <typeparam name="T">view model type</typeparam>
/// <typeparam name="TP">view model parameter type</typeparam>
/// <param name="parameter">view model parameter</param>
/// <param name="app">application</param>
Start application on view model.
Start application on view model .
public static void StartOnViewModel<T, TP>(this Application app, TP parameter) where T : BaseViewModel<TP> where TP : class
        {
            var vm = app.Resolve<T>();
            app.MainPage = new NavigationPage(vm.ResolvePage());
            app.GetDeviceService().RunOnMainThread(async () => await vm.Initiate(parameter));
        }
public static void StartOnViewModel < T , TP > ( this Application app , TP parameter ) where T : BaseViewModel < TP > where TP : class { var vm = app . Resolve < T > ( ) ; app . MainPage = new NavigationPage ( vm . ResolvePage ( ) ) ; app . GetDeviceService ( ) . RunOnMainThread ( async ( ) => await vm . Initiate ( parameter ) ) ; }
Start application on view model.
Start application on view model .
Application
this
parameter
TP
view model parameter
view model parameter
app
None
typeparam
view model type
view model type
typeparam
view model parameter type
view model parameter type