private void StackPanel_RightTapped(object sender, RightTappedRoutedEventArgs e) { var parentContainer = DependencyObjectHelpers.FindParent <GridViewItem>(e.OriginalSource as DependencyObject); if (!parentContainer.IsSelected) { ItemManipulationModel.SetSelectedItem(FileList.ItemFromContainer(parentContainer) as ListedItem); } }
private void ItemManipulationModel_InvertSelectionInvoked(object sender, EventArgs e) { List <ListedItem> newSelectedItems = GetAllItems() .Cast <ListedItem>() .Except(SelectedItems) .ToList(); ItemManipulationModel.SetSelectedItems(newSelectedItems); }
private void StackPanel_RightTapped(object sender, RightTappedRoutedEventArgs e) { var parentContainer = DependencyObjectHelpers.FindParent <ListViewItem>(e.OriginalSource as DependencyObject); if (parentContainer.IsSelected) { return; } // The following code is only reachable when a user RightTapped an unselected row ItemManipulationModel.SetSelectedItem(FileList.ItemFromContainer(parentContainer) as ListedItem); }
private void HandleRightClick(object sender, RoutedEventArgs e) { var rowPressed = DependencyObjectHelpers.FindParent <DataGridRow>(e.OriginalSource as DependencyObject); var objectPressed = rowPressed == null ? null : ((IList <ListedItem>)AllView.ItemsSource).ElementAtOrDefault(rowPressed.GetIndex()); if (rowPressed == null || objectPressed == null) { // Clear the selection if no item was clicked ItemManipulationModel.ClearSelection(); } else if (!IsItemSelected || !SelectedItems.Contains(objectPressed)) { // Select item if it is not already selected ItemManipulationModel.SetSelectedItem(objectPressed); } }
private void ItemManipulationModel_InvertSelectionInvoked(object sender, EventArgs e) { if (SelectedItems.Count < GetAllItems().Cast <ListedItem>().Count() / 2) { var oldSelectedItems = SelectedItems.ToList(); ItemManipulationModel.SelectAllItems(); ItemManipulationModel.RemoveSelectedItems(oldSelectedItems); } else { List <ListedItem> newSelectedItems = GetAllItems() .Cast <ListedItem>() .Except(SelectedItems) .ToList(); ItemManipulationModel.SetSelectedItems(newSelectedItems); } }
private void HandleRightClick(object sender, HoldingRoutedEventArgs e) { var objectPressed = ((FrameworkElement)e.OriginalSource).DataContext as ListedItem; if (objectPressed != null) { { return; } } // Check if RightTapped row is currently selected if (IsItemSelected) { if (SelectedItems.Contains(objectPressed)) { return; } } // The following code is only reachable when a user RightTapped an unselected row ItemManipulationModel.SetSelectedItem(objectPressed); }
private void HandleRightClick(object sender, RoutedEventArgs e) { var rowPressed = DependencyObjectHelpers.FindParent <DataGridRow>(e.OriginalSource as DependencyObject); if (rowPressed != null) { var objectPressed = ((IList <ListedItem>)AllView.ItemsSource).ElementAtOrDefault(rowPressed.GetIndex()); if (objectPressed == null) { return; } // Check if RightTapped row is currently selected if (!IsItemSelected) { if (!SelectedItems.Contains(objectPressed)) { ItemManipulationModel.SetSelectedItem(objectPressed); } } } }
public BaseLayout() { ItemManipulationModel = new ItemManipulationModel(); HookEvents(); jumpTimer = new DispatcherTimer(); jumpTimer.Interval = TimeSpan.FromSeconds(0.8); jumpTimer.Tick += JumpTimer_Tick; SelectedItemsPropertiesViewModel = new SelectedItemsPropertiesViewModel(this); DirectoryPropertiesViewModel = new DirectoryPropertiesViewModel(); // QuickLook Integration ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; var isQuickLookIntegrationEnabled = localSettings.Values["quicklook_enabled"]; if (isQuickLookIntegrationEnabled != null && isQuickLookIntegrationEnabled.Equals(true)) { App.InteractionViewModel.IsQuickLookEnabled = true; } dragOverTimer = DispatcherQueue.GetForCurrentThread().CreateTimer(); }
/// <summary> /// Set a single file or folder to hidden or unhidden an refresh the /// view after setting the flag /// </summary> /// <param name="item"></param> /// <param name="isHidden"></param> public static void SetHiddenAttributeItem(ListedItem item, bool isHidden, ItemManipulationModel itemManipulationModel) { item.IsHiddenItem = isHidden; itemManipulationModel.RefreshItemsOpacity(); }