private async void MenuFlyoutItem_Click_Delete(object sender, RoutedEventArgs e) { item_ = (e.OriginalSource as FrameworkElement)?.DataContext as Items; img.Source = await ThumbnailProcess(item_.StorageFile_); if (Source_.SelectionMode == ListViewSelectionMode.Multiple) { dialogText1.Text = $"{item_.Name}等,共{Source_.SelectedItems.Count}个文件"; dialogText3.Text = ":被删除的文件会进入回收站"; dialogText2.Text = ""; } else { dialogText1.Text = item_.Name; dialogText3.Text = item_.Path; dialogText2.Text = item_.Date; } await DeleteContentDialog.ShowAsync(); // FlyoutBase.GetAttachedFlyout((FrameworkElement)sender).Placement = FlyoutPlacementMode.Full; // FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender); //location_.Locations.Remove(item_); // await item_.StorageFile_.DeleteAsync(); }
private async void DeleteShow_Click(object sender, RoutedEventArgs e) { var btn = sender as Button; var result = await DeleteContentDialog.ShowAsync(); if (result.ToString() == "Primary") { var _GridView = WatchListGrid as GridView; TvShow show = ((Windows.UI.Xaml.FrameworkElement)btn.Parent).DataContext as TvShow; tableQueries.deleteRecord(show.ShowTitle); WatchListGrid.ItemsSource = tableQueries.selectAll(); } }
private async void MenuFlyoutItem_Click_Delete(object sender, RoutedEventArgs e) { img.Source = await ThumbnailProcess(Item_.StorageFile_); dialogText1.Text = Item_.StorageFile_.Name; dialogText3.Text = Item_.StorageFile_.Path; dialogText2.Text = Item_.StorageFile_.DateCreated.ToString(); await DeleteContentDialog.ShowAsync(); // FlyoutBase.GetAttachedFlyout((FrameworkElement)sender).Placement = FlyoutPlacementMode.Full; // FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender); //location_.Locations.Remove(item_); // await item_.StorageFile_.DeleteAsync(); }
private void UserControl_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) { if (args.NewValue is ViewModels.ContentViewModel vm) { void OrderChange(object s, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == nameof(vm.Item.Order)) { foreach (var column in dataGrid.Columns) { if (vm.Item.Order.Key == column.Tag as string && !string.IsNullOrEmpty(column.Tag as string)) { column.SortDirection = vm.Item.Order.KeyIsAscending ? Microsoft.Toolkit.Uwp.UI.Controls.DataGridSortDirection.Ascending : Microsoft.Toolkit.Uwp.UI.Controls.DataGridSortDirection.Descending; } else { column.SortDirection = null; } } } } vm.DialogDelete = async(arg, canDeleteComplete) => { var dialog = new DeleteContentDialog() { IsSecondaryButtonEnabled = canDeleteComplete, XamlRoot = this.XamlRoot }; dialog.DataContext = arg; Windows.UI.Xaml.Controls.ContentDialogResult result; try { result = await dialog.ShowAsync(); } catch { return(false, false); } return(result switch { ContentDialogResult.Primary => (true, false), ContentDialogResult.Secondary => (true, true), _ => (false, false), }); }; vm.PropertyChanged += (s, e) => { if (s != this.DataContext) { return; } if (e.PropertyName == nameof(vm.ContentStyle)) { if (items.ItemTemplateSelector is FileExplorerContentDataSelector fc) { fc.ContentStyle = vm.ContentStyle; if (vm?.RefreshCommand?.CanExecute(null) == true) { vm.RefreshCommand.Execute(null); } } } if (e.PropertyName == nameof(vm.Item)) { vm.Item.PropertyChanged += OrderChange; } }; vm.SetDefaultOrderSelectors(); }