コード例 #1
0
 public async Task DeactivateAsync(NavigationType navigationType, IDeactivationParameters parameters)
 {
     if (navigationType == NavigationType.Backward)
     {
         this.Items.Clear();
     }
 }
コード例 #2
0
        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");
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        public static async Task DeactivateViewModelAsync(object target, NavigationType navigationType, IDeactivationParameters parameters)
        {
            var deactivate = target as IDeactivate;

            if (deactivate != null)
            {
                await deactivate.DeactivateAsync(navigationType, parameters);
            }
        }