Skip to content

Commit

Permalink
v0.7.4 release (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 authored Apr 7, 2020
1 parent ef91932 commit dc69440
Show file tree
Hide file tree
Showing 10 changed files with 352 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Files.Package/Files.Package.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<AppxBundlePlatforms>x86|x64|arm|arm64</AppxBundlePlatforms>
<DisableXbfLineInfo>False</DisableXbfLineInfo>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<UapAppxPackageBuildMode>StoreAndSideload</UapAppxPackageBuildMode>
<UapAppxPackageBuildMode>StoreUpload</UapAppxPackageBuildMode>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<EntryPointProjectUniqueName>..\Files\Files.csproj</EntryPointProjectUniqueName>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions Files.Package/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" IgnorableNamespaces="uap uap5 mp rescap desktop4 desktop">
<Identity Name="FilesUWP" Publisher="CN=Luke Blevins" Version="0.7.4.0" />
<Identity Name="49306atecsolution.FilesUWP" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.7.4.0" />
<Properties>
<DisplayName>Files UWP - Preview</DisplayName>
<PublisherDisplayName>FilesUWP</PublisherDisplayName>
<PublisherDisplayName>Yair A</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
Expand Down
4 changes: 2 additions & 2 deletions Files/BaseLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public List<ListedItem> SelectedItems
{
return _SelectedItems;
}
set
internal set
{
if (value != _SelectedItems)
{
Expand All @@ -77,7 +77,7 @@ public ListedItem SelectedItem
{
return _SelectedItem;
}
set
internal set
{
if (value != _SelectedItem)
{
Expand Down
1 change: 1 addition & 0 deletions Files/Files.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
<DependentUpon>GenericFileBrowser.xaml</DependentUpon>
</Compile>
<Compile Include="View Models\InteractionViewModel.cs" />
<Compile Include="View Models\SelectedItemPropertiesViewModel.cs" />
<Compile Include="Views\InstanceTabsView.xaml.cs">
<DependentUpon>InstanceTabsView.xaml</DependentUpon>
</Compile>
Expand Down
31 changes: 28 additions & 3 deletions Files/Interacts/Interaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,34 @@ public async void ShowPropertiesButton_Click(object sender, RoutedEventArgs e)

public async void ShowFolderPropertiesButton_Click(object sender, RoutedEventArgs e)
{
App.propertiesDialog.propertiesFrame.Tag = App.propertiesDialog;
App.propertiesDialog.propertiesFrame.Navigate(typeof(Properties), App.CurrentInstance.ViewModel.currentFolder, new SuppressNavigationTransitionInfo());
await App.propertiesDialog.ShowAsync(ContentDialogPlacement.Popup);
if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
{
AppWindow appWindow = await AppWindow.TryCreateAsync();
Frame frame = new Frame();
frame.Navigate(typeof(Properties), null, new SuppressNavigationTransitionInfo());
WindowManagementPreview.SetPreferredMinSize(appWindow, new Size(400, 475));
appWindow.RequestSize(new Size(400, 475));
appWindow.Title = "Properties";

ElementCompositionPreview.SetAppWindowContent(appWindow, frame);
AppWindows.Add(frame.UIContext, appWindow);

appWindow.Closed += delegate
{
Interaction.AppWindows.Remove(frame.UIContext);
frame.Content = null;
appWindow = null;
};

await appWindow.TryShowAsync();
}
else
{

App.propertiesDialog.propertiesFrame.Tag = App.propertiesDialog;
App.propertiesDialog.propertiesFrame.Navigate(typeof(Properties), App.CurrentInstance.ViewModel.currentFolder, new SuppressNavigationTransitionInfo());
await App.propertiesDialog.ShowAsync(ContentDialogPlacement.Popup);
}
}

private async void Manager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
Expand Down
33 changes: 17 additions & 16 deletions Files/Properties.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Padding="14" Spacing="14" Grid.Row="0" Orientation="Horizontal">
<StackPanel Padding="22,14" Spacing="14" Grid.Row="0" Orientation="Horizontal">

<Grid
x:Name="Icon"
Expand All @@ -32,21 +32,22 @@
FontSize="36"
Foreground="#ffe793"
Glyph="&#xE8D5;"
Visibility="{x:Bind local:App.CurrentInstance.ContentPage.SelectedItem.FolderImg}" />
x:Name="FolderGlyphIcon"
x:Load="{x:Bind itemProperties.LoadFolderGlyph,Mode=OneWay}" />
<FontIcon
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
FontFamily="Segoe MDL2 Assets"
FontSize="36"
x:Name="EmptyImageIcon"
Glyph="&#xE7C3;"
Visibility="{x:Bind local:App.CurrentInstance.ContentPage.SelectedItem.EmptyImgVis}" />
x:Load="{x:Bind itemProperties.LoadUnknownTypeGlyph,Mode=OneWay}" />
<Image
x:Name="itemIcon"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Loading="itemIcon_Loading"
Visibility="{x:Bind local:App.CurrentInstance.ContentPage.SelectedItem.FileIconVis}" />
x:Load="{x:Bind itemProperties.LoadFileIcon,Mode=OneWay}"
Source="{x:Bind itemProperties.FileIconSource,Mode=OneWay}"/>
</Grid>
<TextBox
x:Name="itemFileName"
Expand All @@ -56,7 +57,7 @@
VerticalAlignment="Center"
BorderThickness="1"
IsReadOnly="True"
Text="{x:Bind local:App.CurrentInstance.ContentPage.SelectedItem.FileName}" Width="285" />
Text="{x:Bind itemProperties.ItemName,Mode=OneWay}" Width="300" />
</StackPanel>
<StackPanel Padding="14,0" Grid.Row="1">
<MenuFlyoutSeparator Margin="-14,0" HorizontalAlignment="Stretch" />
Expand All @@ -67,10 +68,10 @@
</Grid.ColumnDefinitions>
<TextBlock x:Uid="PropertiesItemType" Text="Item type:" />
<TextBlock
x:Name="itemType"
x:Name="itemTypeValue"
Grid.Column="1"
IsTextSelectionEnabled="True"
Text="{x:Bind local:App.CurrentInstance.ContentPage.SelectedItem.FileType}" />
Text="{x:Bind itemProperties.ItemType,Mode=OneWay}" />
</Grid>
<Grid Padding="0,4">
<Grid.ColumnDefinitions>
Expand All @@ -79,10 +80,10 @@
</Grid.ColumnDefinitions>
<TextBlock x:Uid="PropertiesItemPath" Text="Path:" />
<TextBlock
x:Name="itemPath"
x:Name="itemPathValue"
Grid.Column="2"
IsTextSelectionEnabled="True"
Text="{x:Bind local:App.CurrentInstance.ContentPage.SelectedItem.FilePath}"
Text="{x:Bind itemProperties.ItemPath,Mode=OneWay}"
TextWrapping="Wrap" />
</Grid>
<Grid Padding="0,4">
Expand All @@ -92,10 +93,10 @@
</Grid.ColumnDefinitions>
<TextBlock x:Uid="PropertiesItemSize" Text="Size:" />
<TextBlock
x:Name="itemSize"
x:Name="itemSizeValue"
Grid.Column="3"
IsTextSelectionEnabled="True"
Text="{x:Bind local:App.CurrentInstance.ContentPage.SelectedItem.FileSize}" />
Text="{x:Bind itemProperties.ItemSize,Mode=OneWay}" />
</Grid>
<MenuFlyoutSeparator Margin="-14,0" />
<Grid Padding="0,4">
Expand All @@ -105,10 +106,10 @@
</Grid.ColumnDefinitions>
<TextBlock x:Uid="PropertiesCreated" Text="Created:" />
<TextBlock
x:Name="itemCreatedTimestamp"
x:Name="itemCreatedTimestampValue"
Grid.Column="4"
IsTextSelectionEnabled="True"
Text="{x:Bind local:App.CurrentInstance.ContentPage.SelectedItem.FileDate}" />
Text="{x:Bind itemProperties.ItemCreatedTimestamp,Mode=OneWay}" />
</Grid>
<Grid Padding="0,4">
<Grid.ColumnDefinitions>
Expand All @@ -117,10 +118,10 @@
</Grid.ColumnDefinitions>
<TextBlock x:Uid="PropertiesModified" Text="Modified:" />
<TextBlock
x:Name="itemModifiedTimestamp"
x:Name="itemModifiedTimestampValue"
Grid.Column="5"
IsTextSelectionEnabled="True"
Text="{x:Bind local:App.CurrentInstance.ContentPage.SelectedItem.FileDate}" />
Text="{x:Bind itemProperties.ItemModifiedTimestamp,Mode=OneWay}" />
</Grid>

</StackPanel>
Expand Down
121 changes: 105 additions & 16 deletions Files/Properties.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using Files.Interacts;
using Files.Filesystem;
using Files.Interacts;
using GalaSoft.MvvmLight;
using System;
using Windows.Foundation.Metadata;
using Windows.Storage;
using Windows.UI.WindowManagement;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;

namespace Files
Expand All @@ -12,7 +15,7 @@ namespace Files
public sealed partial class Properties : Page
{
public AppWindow propWindow;

public ItemPropertiesViewModel itemProperties { get; } = new ItemPropertiesViewModel();
public Properties()
{
this.InitializeComponent();
Expand All @@ -26,34 +29,55 @@ public Properties()
}
}

private void Properties_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
private async void Properties_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
// Collect AppWindow-specific info
propWindow = Interaction.AppWindows[this.UIContext];
}

private async void itemIcon_Loading(Windows.UI.Xaml.FrameworkElement sender, object args)
{
if (App.CurrentInstance.ContentPage.SelectedItem != null)
if (App.CurrentInstance.ContentPage.IsItemSelected)
{
var selectedItem = App.CurrentInstance.ContentPage.SelectedItem;
IStorageItem selectedStorageItem;
try
{
selectedStorageItem = await StorageFolder.GetFolderFromPathAsync(selectedItem.FilePath);
}
catch (Exception)
{
// Not a folder, so attempt to get as StorageFile
selectedStorageItem = await StorageFile.GetFileFromPathAsync(selectedItem.FilePath);
}
itemProperties.ItemName = selectedItem.FileName;
itemProperties.ItemType = selectedItem.FileType;
itemProperties.ItemPath = selectedItem.FilePath;
itemProperties.ItemSize = selectedItem.FileSize;
itemProperties.LoadFileIcon = selectedItem.FileIconVis == Windows.UI.Xaml.Visibility.Visible ? true : false;
itemProperties.LoadFolderGlyph = selectedItem.FolderImg == Windows.UI.Xaml.Visibility.Visible ? true : false;
itemProperties.LoadUnknownTypeGlyph = selectedItem.EmptyImgVis == Windows.UI.Xaml.Visibility.Visible ? true : false;
itemProperties.ItemModifiedTimestamp = selectedItem.FileDate;
itemProperties.ItemCreatedTimestamp = ListedItem.GetFriendlyDate(selectedStorageItem.DateCreated);

if (App.CurrentInstance.ContentPage.SelectedItem.FolderImg != Windows.UI.Xaml.Visibility.Visible)
{
var thumbnail = await (await StorageFile.GetFileFromPathAsync(App.CurrentInstance.ContentPage.SelectedItem.FilePath)).GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode.SingleItem, 40, Windows.Storage.FileProperties.ThumbnailOptions.ResizeThumbnail);
var bitmap = new BitmapImage();
await bitmap.SetSourceAsync(thumbnail);
itemIcon.Source = bitmap;
}
else
{
EmptyImageIcon.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
itemProperties.FileIconSource = bitmap;
}
}
else
{
EmptyImageIcon.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
var parentDirectory = App.CurrentInstance.ViewModel.currentFolder;
var parentDirectoryStorageItem = await StorageFolder.GetFolderFromPathAsync(parentDirectory.FilePath);
itemProperties.ItemName = parentDirectory.FileName;
itemProperties.ItemType = parentDirectory.FileType;
itemProperties.ItemPath = parentDirectory.FilePath;
itemProperties.ItemSize = parentDirectory.FileSize;
itemProperties.LoadFileIcon = false;
itemProperties.LoadFolderGlyph = true;
itemProperties.LoadUnknownTypeGlyph = false;
itemProperties.ItemModifiedTimestamp = parentDirectory.FileDate;
itemProperties.ItemCreatedTimestamp = ListedItem.GetFriendlyDate(parentDirectoryStorageItem.DateCreated);
}


}

private async void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
Expand All @@ -64,4 +88,69 @@ private async void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e
}
}
}

public class ItemPropertiesViewModel : ViewModelBase
{
private string _ItemName;
private string _ItemType;
private string _ItemPath;
private string _ItemSize;
private string _ItemCreatedTimestamp;
private string _ItemModifiedTimestamp;
private ImageSource _FileIconSource;
private bool _LoadFolderGlyph;
private bool _LoadUnknownTypeGlyph;
private bool _LoadFileIcon;

public string ItemName
{
get => _ItemName;
set => Set(ref _ItemName, value);
}
public string ItemType
{
get => _ItemType;
set => Set(ref _ItemType, value);
}
public string ItemPath
{
get => _ItemPath;
set => Set(ref _ItemPath, value);
}
public string ItemSize
{
get => _ItemSize;
set => Set(ref _ItemSize, value);
}
public string ItemCreatedTimestamp
{
get => _ItemCreatedTimestamp;
set => Set(ref _ItemCreatedTimestamp, value);
}
public string ItemModifiedTimestamp
{
get => _ItemModifiedTimestamp;
set => Set(ref _ItemModifiedTimestamp, value);
}
public ImageSource FileIconSource
{
get => _FileIconSource;
set => Set(ref _FileIconSource, value);
}
public bool LoadFolderGlyph
{
get => _LoadFolderGlyph;
set => Set(ref _LoadFolderGlyph, value);
}
public bool LoadUnknownTypeGlyph
{
get => _LoadUnknownTypeGlyph;
set => Set(ref _LoadUnknownTypeGlyph, value);
}
public bool LoadFileIcon
{
get => _LoadFileIcon;
set => Set(ref _LoadFileIcon, value);
}
}
}
14 changes: 14 additions & 0 deletions Files/View Models/ItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,20 @@ public async void RapidAddItemsToCollectionAsync(string path)
try
{
_rootFolder = await StorageFolder.GetFolderFromPathAsync(path);
_rootFolderItem = new ListedItem(_rootFolder.FolderRelativeId)
{
ItemPropertiesInitialized = true,
FileName = _rootFolder.Name,
FileDateReal = (await _rootFolder.GetBasicPropertiesAsync()).DateModified,
FileType = "Folder", //TODO: Take a look at folder.DisplayType
FolderImg = Visibility.Visible,
FileImg = null,
FileIconVis = Visibility.Collapsed,
FilePath = _rootFolder.Path,
EmptyImgVis = Visibility.Collapsed,
FileSize = null,
FileSizeBytes = 0
};
}
catch (UnauthorizedAccessException)
{
Expand Down
Loading

0 comments on commit dc69440

Please sign in to comment.