public void Start <V>() where V : XPlatViewModel { var view = Activator.CreateInstance(_viewModelLookup[typeof(V)]) as LagoVistaContentPage; _navigation = view.Navigation; var viewModel = SLWIOC.CreateForType <V>(); view.ViewModel = viewModel; _app.MainPage = new LagoVistaNavigationPage(view) { Title = "HelloWorld" }; Debug.WriteLine(_app.MainPage); }
private Task ShowViewModelAsync(ViewModelLaunchArgs args) { if (args.ParentViewModel == null) { args.ParentViewModel = ViewModelBackStack.FirstOrDefault(); } var view = Activator.CreateInstance(_viewModelLookup[args.ViewModelType]) as LagoVistaContentPage; var viewModel = SLWIOC.CreateForType(args.ViewModelType) as XPlatViewModel; ViewModelBackStack.Push(viewModel); viewModel.LaunchArgs = args; view.ViewModel = viewModel; return(_navigation.PushAsync(view)); }
public Task SetAsNewRootAsync(Type viewModelType, params KeyValuePair <string, object>[] args) { var viewModel = SLWIOC.CreateForType(viewModelType) as ViewModelBase; viewModel.LaunchArgs = new ViewModelLaunchArgs() { IsNewRoot = true, LaunchType = LaunchTypes.Other, }; ViewModelBackStack.Clear(); ViewModelBackStack.Push(viewModel); var view = Activator.CreateInstance(_viewModelLookup[viewModelType]) as LagoVistaContentPage; view.ViewModel = viewModel as XPlatViewModel; _navigation = view.Navigation; _app.MainPage = new LagoVistaNavigationPage(view); return(Task.FromResult(default(object))); }