public AsyncTask Reveal(ViewModel vm, VisibilityEvent.OnceEventHandler handler = null) { Contract.ArgumentNotNull("vm", vm); return(new AsyncTask((prevResult, onCompleted, onError) => { try { DebugLog.Info("StageManager.Reveal: {0}", vm.GetType().Name); IView view = revealedViews.FirstOrDefault(v => v.BindingContext == vm); if (view == null) { view = viewFactory.Resolve(vm); view.BindingContext = vm; revealedViews.Add(view); view.Reveal(false, (IView revealedView) => { onCompleted(revealedView.BindingContext); }); } } catch (Exception e) { onError(e); } })); }
public ViewModel Hide(ViewModel vm, VisibilityEvent.OnceEventHandler handler = null) { Contract.ArgumentNotNull("vm", vm); DebugLog.Info("StageManager.Hide: {0}", vm.GetType().Name); IView view = revealedViews.FirstOrDefault(v => v.BindingContext == vm); if (view != null) { view.Hide(false, handler); revealedViews.Remove(view); } return(vm); }
public void Hide(bool immediate = false, VisibilityEvent.OnceEventHandler handler = null) { if (handler != null) { HiddenEvent.EventTriggered += handler; } OnDisappearing(); if (immediate || !BindingContext.IsRevealed) { OnHidden(); } else { GetComponent <Animator>().SetTrigger("Hide"); } }
public void Reveal(bool immediate = false, VisibilityEvent.OnceEventHandler handler = null) { if (handler != null) { RevealedEvent.EventTriggered += handler; } OnAppearing(); if (immediate || BindingContext.IsRevealed) { OnVisible(); } else { GetComponent <Animator>().SetTrigger("Show"); } }
public void Reveal(bool immediate = false, VisibilityEvent.OnceEventHandler handler = null) { if (handler != null) { RevealedEvent.EventTriggered += handler; } OnAppearing(); if (immediate || BindingContext.IsRevealed) { OnVisible(); } else { SceneService.Instance.LoadScene(sceneName, true, (bool success, string error) => { IsLoaded = true; OnVisible(); }); } }