public async Task DeactivateAsync(NavigationType navigationType, IDeactivationParameters parameters) { if (navigationType == NavigationType.Backward) { this.Items.Clear(); } }
public async Task <bool> CanDeactivateAsync(NavigationType navigationType, IDeactivationParameters parameters) { // Do NOT normally do this in you MMVM application, using dialogs and other View-related things breaks MVVM // This is here only for simplicity var dlg = new MessageDialog(Item.Content + " is trying to deactivate, allow?"); dlg.Commands.Add(new UICommand("Yes")); dlg.Commands.Add(new UICommand("No")); return((await dlg.ShowAsync()).Label == "Yes"); }
public async Task DeactivateAsync(NavigationType navigationType, IDeactivationParameters parameters) { this.IsWorking = true; // simulate sync with cloud await Task.Delay(3000); this.IsWorking = false; this.Item = null; }
public static async Task <bool> CanDeactivateViewModelAsync(object target, NavigationType navigationType, IDeactivationParameters parameters) { var query = target as IDeactivateQuery; if (query != null) { if (!await query.CanDeactivateAsync(navigationType, parameters)) { return(false); } } return(true); }
public static async Task DeactivateViewModelAsync(object target, NavigationType navigationType, IDeactivationParameters parameters) { var deactivate = target as IDeactivate; if (deactivate != null) { await deactivate.DeactivateAsync(navigationType, parameters); } }