public static bool Navigate <T>(this Page page, string address, UriKind uriKind, T model) where T : ViewModel { var guid = ViewModelContainer.Push(model); var pageAddress = string.Format("{0}?modelId={1}", address, guid); return(page.NavigationService.Navigate(new Uri(pageAddress, uriKind))); }
/// <Docs>Bundle in which to place your saved state.</Docs> /// <summary> /// Raises the save instance state event and puts the ViewModel back into the container. /// </summary> /// <param name="outState">Out state.</param> protected override void OnSaveInstanceState(Android.OS.Bundle outState) { var guid = ViewModelContainer.Push(this.Model); outState.PutString(ModelId, guid.ToString()); base.OnSaveInstanceState(outState); }
public static bool StartActivity <T, TModel>(this Context context, TModel model) where TModel : ViewModel where T : ViewModelActivity <TModel> { var guid = ViewModelContainer.Push(model); var intent = new Intent(context, typeof(T)); intent.PutExtra("modelId", guid.ToString()); if (!(context is Activity)) { intent.AddFlags(ActivityFlags.NewTask); } context.StartActivity(intent); return(true); }
public override bool NavigateTo <T>(object sender, T model) { if (base.NavigateTo <T> (sender, model)) { return(true); } Intent intent; if (TryGetIntent(model, sender, out intent)) { var guid = ViewModelContainer.Push(model); intent.PutExtra("modelId", guid.ToString()); sender.StartActivity(intent); return(true); } return(false); }