Skip to content

Commit

Permalink
Tweaks to the Item Cut Process
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeb authored and lukeb committed Apr 13, 2019
1 parent 04c82c4 commit b65e85a
Show file tree
Hide file tree
Showing 16 changed files with 243 additions and 442 deletions.
2 changes: 2 additions & 0 deletions Files UWP/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public App()
else
{
localSettings.Values["theme"] = "Default";
ProHome.RibbonTeachingTip.IsOpen = false;
}

this.RequestedTheme = SettingsPages.Personalization.TV.ThemeValue;
Expand All @@ -63,6 +64,7 @@ public App()
public static Interacts.Home.HomeItemsState HomeItems { get; set; } = new Interacts.Home.HomeItemsState();
public static Interacts.Share.ShareItemsState ShareItems { get; set; } = new Interacts.Share.ShareItemsState();
public static Interacts.Layout.LayoutItemsState LayoutItems { get; set; } = new Interacts.Layout.LayoutItemsState();
public static Interacts.AlwaysPresentCommandsState AlwaysPresentCommands { get; set; } = new Interacts.AlwaysPresentCommandsState();
public static DisplayedPathText PathText { get; set; } = new DisplayedPathText();

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Files UWP/FilesUWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Expand Down
18 changes: 6 additions & 12 deletions Files UWP/Filesystem/ItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public async void AddItemsToCollectionAsync(string path, Page currentPage)
TextState.isVisible = Visibility.Visible;
}
stopwatch.Stop();
Debug.WriteLine("Loading of items in " + Universal.path + " completed in " + stopwatch.Elapsed.Seconds + " seconds.\n");
Debug.WriteLine("Loading of items in " + Universal.path + " completed in " + stopwatch.Elapsed.Milliseconds + " milliseconds.\n");

}
catch (UnauthorizedAccessException e)
Expand Down Expand Up @@ -297,7 +297,9 @@ private async Task AddFolder(StorageFolder folder, string pageName, Cancellation
FileIconVis = Visibility.Collapsed,
FilePath = folder.Path,
EmptyImgVis = Visibility.Collapsed,
FileSize = null
FileSize = null,
RowIndex = _filesAndFolders.Count

});
}
else
Expand Down Expand Up @@ -397,7 +399,8 @@ private async Task AddFile(StorageFile file, string pageName, CancellationToken
FileDateReal = itemDate,
FileType = itemType,
FilePath = itemPath,
FileSize = itemSize
FileSize = itemSize,
RowIndex = _filesAndFolders.Count
});
}
else
Expand Down Expand Up @@ -483,14 +486,5 @@ await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPrio
_filesRefreshing = false;
Debug.WriteLine("Filesystem refresh complete");
}

//private async void FolderContentsChanged(IStorageQueryResultBase sender, object args)
//{
// if (_foldersRefreshing) { return; }

// _foldersRefreshing = true;

// _foldersRefreshing = false;
//}
}
}
2 changes: 1 addition & 1 deletion Files UWP/Filesystem/ListedItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace Files.Filesystem
public class ListedItem
{
public string FolderRelativeId { get; }

public Visibility FolderImg { get; set; }
public Visibility FileIconVis { get; set; }
public Visibility EmptyImgVis { get; set; }
Expand All @@ -18,6 +17,7 @@ public class ListedItem
public string DotFileExtension { get; set; }
public string FilePath { get; set; }
public string FileSize { get; set; }
public int RowIndex { get; set; }

public DateTimeOffset FileDateReal
{
Expand Down
69 changes: 34 additions & 35 deletions Files UWP/GenericFileBrowser.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
xmlns:local2="using:Files.Filesystem"
xmlns:local3="using:Files.Interacts"
Name="GenericItemView"
mc:Ignorable="d" NavigationCacheMode="Required" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" IsRightTapEnabled="True" RightTapped="GenericItemView_RightTapped" PointerReleased="GenericItemView_PointerReleased">
mc:Ignorable="d" NavigationCacheMode="Required" PointerReleased="GenericItemView_PointerReleased" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Page.Resources>
<Style x:Key="TextBoxStyleForPathBar" TargetType="TextBox">
<Setter Property="Foreground" Value="{ThemeResource DefaultTextForegroundThemeBrush}"/>
Expand Down Expand Up @@ -144,41 +144,39 @@
</Setter.Value>
</Setter>
</Style>

</Page.Resources>
<Page.ContextFlyout>
<MenuFlyout x:Name="EmptySpaceFlyout">
<MenuFlyout.Items>
<MenuFlyoutItem Text="Refresh" Name="RefreshEmptySpace">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE72C;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem Text="Paste" Name="PasteEmptySpace" IsEnabled="{x:Bind local3:Interaction.PS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE77F;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem Text="Open in PowerShell...">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE756;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutSeparator/>
<MenuFlyoutItem Text="Properties">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE946;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>

</MenuFlyout.Items>
</MenuFlyout>
</Page.ContextFlyout>

<Grid Name="RootGrid">
<TextBlock Name="EmptyText" Visibility="{x:Bind local:App.ViewModel.TextState.isVisible, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Text="This folder is empty." TextWrapping="Wrap" VerticalAlignment="Top" Margin="0,125,0,0" Canvas.ZIndex="0"/>
<controls:DataGrid AllowDrop="True" Drop="AllView_DropAsync" DragLeave="AllView_DragLeave" DragStarting="AllView_DragStarting" ContextRequested="AllView_ContextRequested" SelectionChanged="AllView_SelectionChanged" Margin="24,24,0,0" Grid.Row="3" CellEditEnded="AllView_CellEditEnded" FocusVisualPrimaryThickness="0" SelectionMode="Extended" IsDoubleTapEnabled="True" x:FieldModifier="public" x:Name="AllView" AutoGenerateColumns="False" CanDrag="True" DragOver="AllView_DragOver" IsRightTapEnabled="True" CanUserReorderColumns="False" IsReadOnly="True" ItemsSource="{x:Bind local:App.ViewModel.FilesAndFolders}" HorizontalAlignment="Left">
<Grid Background="Transparent" Name="RootGrid">
<Grid.ContextFlyout>
<MenuFlyout>
<MenuFlyout.Items>
<MenuFlyoutItem Text="Refresh" Name="RefreshEmptySpace">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE72C;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem Text="Paste" Name="PasteEmptySpace" IsEnabled="{x:Bind local3:Interaction.PS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE77F;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutItem Text="Open in PowerShell...">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE756;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<MenuFlyoutSeparator/>
<MenuFlyoutItem Text="Properties">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE946;"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>

</MenuFlyout.Items>
</MenuFlyout>
</Grid.ContextFlyout>
<TextBlock Name="EmptyText" Visibility="{x:Bind local:App.ViewModel.TextState.isVisible, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Text="This folder is empty." TextWrapping="Wrap" VerticalAlignment="Top" Margin="0,125,0,0"/>
<controls:DataGrid DataContext="{x:Bind local:App.ViewModel.FilesAndFolders}" RowDetailsVisibilityMode="Collapsed" AllowDrop="True" Drop="AllView_DropAsync" DragLeave="AllView_DragLeave" DragStarting="AllView_DragStarting" SelectionChanged="AllView_SelectionChanged" Margin="24,24,0,0" Grid.Row="3" CellEditEnded="AllView_CellEditEnded" FocusVisualPrimaryThickness="0" SelectionMode="Extended" IsDoubleTapEnabled="True" x:FieldModifier="public" x:Name="AllView" AutoGenerateColumns="False" CanDrag="True" DragOver="AllView_DragOver" IsRightTapEnabled="True" CanUserReorderColumns="False" IsReadOnly="True" ItemsSource="{x:Bind local:App.ViewModel.FilesAndFolders}" HorizontalAlignment="Left">
<controls:DataGrid.ColumnHeaderStyle>
<Style TargetType="controlsprimitives:DataGridColumnHeader">
<Setter Property="ContextFlyout">
Expand Down Expand Up @@ -282,7 +280,8 @@
<controls:DataGridTemplateColumn IsReadOnly="True">
<controls:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid Margin="15, 0, 0, 0">
<Grid Name="Icon" Margin="15, 0, 0, 0">
<Rectangle Visibility="Collapsed" Name="CutIndicator" Opacity="0.1" Fill="LightGray"/>
<FontIcon Visibility="{Binding FolderImg}" Glyph="&#xE8D5;" FontFamily="Segoe MDL2 Assets" Foreground="#ffe793"/>
<FontIcon Visibility="{Binding EmptyImgVis}" Glyph="&#xE7C3;" FontFamily="Segoe MDL2 Assets"/>
<Image Visibility="{Binding FileIconVis}" Height="20" Width="20" Source="{Binding FileImg}" Stretch="UniformToFill" />
Expand All @@ -293,7 +292,7 @@
<controls:DataGridTextColumn IsReadOnly="True" Header="Name" Width="275" Binding="{Binding FileName}" Tag="Name"/>
<controls:DataGridTextColumn IsReadOnly="True" Header="Date modified" Width="Auto" Binding="{Binding FileDate}" Tag="Date"/>
<controls:DataGridTextColumn IsReadOnly="True" Header="Type" Width="150" Binding="{Binding FileType}" Tag="Type"/>
<controls:DataGridTextColumn IsReadOnly="True" Header="Size" Binding="{Binding FileSize}" Tag="Size"/>
<controls:DataGridTextColumn IsReadOnly="True" Header="Size" Width="100" Binding="{Binding FileSize}" Tag="Size"/>
</controls:DataGrid.Columns>
</controls:DataGrid>

Expand Down
111 changes: 10 additions & 101 deletions Files UWP/GenericFileBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ public GenericFileBrowser()
CopyItem.Click += Interaction.CopyItem_ClickAsync;
AllView.RightTapped += Interaction.AllView_RightTapped;
AllView.DoubleTapped += Interaction.List_ItemClick;
//Clipboard.ContentChanged += Clipboard_ContentChanged;
Clipboard.ContentChanged += Clipboard_ContentChanged;
//AddItemBox = AddDialog;
//NameBox = NameDialog;
//inputFromRename = RenameInput;
emptySpaceContext = EmptySpaceFlyout;
RefreshEmptySpace.Click += NavigationActions.Refresh_Click;
PasteEmptySpace.Click += Interaction.PasteItem_ClickAsync;
//CopiedFlyout = CopiedPathFlyout;
Expand Down Expand Up @@ -107,126 +106,52 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
base.OnNavigatedTo(eventArgs);
ProHome.BackButton.IsEnabled = ProHome.accessibleContentFrame.CanGoBack;
ProHome.ForwardButton.IsEnabled = ProHome.accessibleContentFrame.CanGoForward;
ProHome.RS.isEnabled = true;
App.AlwaysPresentCommands.isEnabled = true;
var parameters = (string)eventArgs.Parameter;
App.ViewModel.CancelLoadAndClearFiles();
App.ViewModel.Universal.path = parameters;
//ProHome.BackButton.Click += NavigationActions.Back_Click;
//ProHome.ForwardButton.Click += NavigationActions.Forward_Click;
ProHome.RefreshButton.Click += NavigationActions.Refresh_Click;
ProHome.AddItemButton.Click += AddItem_Click;
App.ViewModel.AddItemsToCollectionAsync(App.ViewModel.Universal.path, GenericItemView);
Interaction.page = this;
if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)))
{
App.PathText.Text = "Desktop";
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
//{
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "DesktopIC")
// {
// MainPage.Select.itemSelected = NavItemChoice;
// break;
// }
//}
}
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)))
{
App.PathText.Text = "Documents";
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
//{
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "DocumentsIC")
// {
// MainPage.Select.itemSelected = NavItemChoice;
// break;
// }
//}
}
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\Downloads"))
{
App.PathText.Text = "Downloads";
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
//{
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "DownloadsIC")
// {
// MainPage.Select.itemSelected = NavItemChoice;
// break;
// }
//}
}
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)))
{
App.PathText.Text = "Pictures";
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
//{
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "PicturesIC")
// {
// MainPage.Select.itemSelected = NavItemChoice;
// break;
// }
//}
}
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyMusic)))
{
App.PathText.Text = "Music";
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
//{
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "MusicIC")
// {
// MainPage.Select.itemSelected = NavItemChoice;
// break;
// }
//}
}
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\OneDrive"))
{
App.PathText.Text = "OneDrive";
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
//{
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "OneD_IC")
// {
// MainPage.Select.itemSelected = NavItemChoice;
// break;
// }
//}
}
else if (parameters.Equals(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos)))
{
App.PathText.Text = "Videos";
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
//{
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Name.ToString() == "VideosIC")
// {
// MainPage.Select.itemSelected = NavItemChoice;
// break;
// }
//}
}
else
{
//App.ViewModel.Universal.path = parameters;
App.PathText.Text = parameters;
if (parameters.Contains("C:\\") || parameters.Contains("c:\\"))
{
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
//{
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Tag.ToString() == "LDPage")
// {
// MainPage.Select.itemSelected = NavItemChoice;
// break;
// }
//}
}
else
{
//foreach (Microsoft.UI.Xaml.Controls.NavigationViewItemBase NavItemChoice in MainPage.nv.MenuItems)
//{
// if (NavItemChoice is Microsoft.UI.Xaml.Controls.NavigationViewItem && NavItemChoice.Tag.ToString().Contains(parameters.Split("\\")[0]))
// {
// MainPage.Select.itemSelected = NavItemChoice;
// break;
// }
//}
}
}

if(Interaction.dataGridRows != null)
{

}
}


Expand Down Expand Up @@ -301,12 +226,12 @@ private void ContentDialog_Loaded(object sender, RoutedEventArgs e)

private void GenericItemView_PointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
{
data.SelectedItems.Clear();
data.SelectedItem = null;
}

private void AllView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{

AllView.CommitEdit();
if(e.AddedItems.Count > 0)
{
Expand All @@ -331,22 +256,6 @@ private void NameDialog_SecondaryButtonClick(ContentDialog sender, ContentDialog

}

private async void VisiblePath_TextChanged(object sender, KeyRoutedEventArgs e)
{


}

private void GenericItemView_RightTapped(object sender, RightTappedRoutedEventArgs e)
{
GFBPageName.ContextFlyout.ShowAt(GFBPageName);
}

private void AllView_ContextRequested(UIElement sender, ContextRequestedEventArgs args)
{

}

private void AllView_DragStarting(UIElement sender, DragStartingEventArgs args)
{
args.DragUI.SetContentFromDataPackage();
Expand Down
Loading

0 comments on commit b65e85a

Please sign in to comment.