コード例 #1
0
        public async void Execute(object parameter)
        {
            BucketInfoViewModel bucketInfoVM = parameter as BucketInfoViewModel;

            ContentDialog deleteBucketDialog = new ContentDialog
            {
                Title             = "Delete '" + bucketInfoVM.BucketInfo.Name + "'",
                Content           = "Do you really want to delete the bucket '" + bucketInfoVM.BucketInfo.Name + "' and ALL IT's CONTENT?",
                CloseButtonText   = "No",
                PrimaryButtonText = "Yes"
            };

            ContentDialogResult result = await deleteBucketDialog.ShowAsync();

            if (result != ContentDialogResult.Primary)
            {
                return;
            }

            try
            {
                await _bucketService.DeleteBucketAsync(bucketInfoVM.BucketInfo.Name);
            }
            catch (Exception ex)
            {
                Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog("Could not delete bucket - " + ex.Message);
                await dialog.ShowAsync();

                return;
            }
            var frame = (Windows.UI.Xaml.Controls.Frame)Windows.UI.Xaml.Window.Current.Content;

            frame.Navigate(typeof(BucketListPage));
        }
コード例 #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            BucketInfoViewModel bucketVM = e.Parameter as BucketInfoViewModel;

            _vm.SetBucketName(bucketVM.BucketInfo.Name);
            _vm.InitAsync();
        }