Skip to content

v0.8.0 (#742) #744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Files.Package/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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="FilesUWPDev" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.7.9.0" />
<Identity Name="FilesUWPDev" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.8.0.0" />
<Properties>
<DisplayName>Files UWP - Dev</DisplayName>
<PublisherDisplayName>Yair A</PublisherDisplayName>
Expand Down Expand Up @@ -54,4 +54,4 @@
<uap:Capability Name="removableStorage" />
<Capability Name="internetClient"/>
</Capabilities>
</Package>
</Package>
5 changes: 3 additions & 2 deletions Files/Files.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -149,7 +149,8 @@
<Compile Include="Dialogs\ConfirmDeleteDialog.xaml.cs">
<DependentUpon>ConfirmDeleteDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Helpers\AppTheme.cs" />
<Compile Include="Helpers\AcrylicTheme.cs" />
<Compile Include="Helpers\DispatcherHelper.cs" />
<Compile Include="Helpers\ItemsDataTemplateSelector.cs" />
<Compile Include="Helpers\NaturalStringComparer.cs" />
<Compile Include="Helpers\StringExtensions.cs" />
Expand Down
18 changes: 2 additions & 16 deletions Files/Helpers/AppTheme.cs → Files/Helpers/AcrylicTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,12 @@

namespace Files.Helpers
{
public class AppTheme : INotifyPropertyChanged
public class AcrylicTheme : INotifyPropertyChanged
{
private double? _TintLuminosityOpacity;
private Color _FallbackColor;
private Color _TintColor;
private double _TintOpacity;

public double? TintLuminosityOpacity
{
get { return _TintLuminosityOpacity; }
set
{
_TintLuminosityOpacity = value;
NotifyPropertyChanged("TintLuminosityOpacity");
}
}

public Color FallbackColor
{
get { return _FallbackColor; }
Expand Down Expand Up @@ -59,29 +48,26 @@ private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

public AppTheme()
public AcrylicTheme()
{
}

public void SetDefaultTheme()
{
TintLuminosityOpacity = 0.9;
FallbackColor = (Color)Application.Current.Resources["SystemChromeMediumLowColor"];
TintColor = (Color)Application.Current.Resources["SystemAltHighColor"];
TintOpacity = 0.9;
}

public void SetLightTheme()
{
TintLuminosityOpacity = 0.9;
FallbackColor = Color.FromArgb(255, 242, 242, 242);
TintColor = Colors.White;
TintOpacity = 0.9;
}

public void SetDarkTheme()
{
TintLuminosityOpacity = 0.9;
FallbackColor = Color.FromArgb(255, 43, 43, 43);
TintColor = Colors.Black;
TintOpacity = 0.7;
Expand Down
82 changes: 82 additions & 0 deletions Files/Helpers/DispatcherHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using System;
using System.Runtime.CompilerServices;
using Windows.UI.Core;

namespace Files.Helpers
{
/// <summary>
/// This class provides static methods helper for executing code in UI thread of the main window.
/// </summary>
static class DispatcherHelper
{ /// <summary>
/// This struct represents an awaitable dispatcher.
/// </summary>
public struct DispatcherPriorityAwaitable
{
private readonly CoreDispatcher dispatcher;
private readonly CoreDispatcherPriority priority;

internal DispatcherPriorityAwaitable(CoreDispatcher dispatcher, CoreDispatcherPriority priority)
{
this.dispatcher = dispatcher;
this.priority = priority;
}

/// <summary>
/// Get awaiter of DispatcherPriorityAwaiter
/// </summary>
/// <returns>Awaiter of DispatcherPriorityAwaiter</returns>
public DispatcherPriorityAwaiter GetAwaiter()
{
return new DispatcherPriorityAwaiter(this.dispatcher, this.priority);
}
}

/// <summary>
/// This struct represents the awaiter of a dispatcher.
/// </summary>
public struct DispatcherPriorityAwaiter : INotifyCompletion
{
private readonly CoreDispatcher dispatcher;
private readonly CoreDispatcherPriority priority;

/// <summary>
/// Gets a value indicating whether task has completed
/// </summary>
public bool IsCompleted => false;

internal DispatcherPriorityAwaiter(CoreDispatcher dispatcher, CoreDispatcherPriority priority)
{
this.dispatcher = dispatcher;
this.priority = priority;
}

/// <summary>
/// Get result for this awaiter
/// </summary>
public void GetResult()
{
}

/// <summary>
/// Fired once task has complated for notify completion
/// </summary>
/// <param name="continuation">Continuation action</param>
public async void OnCompleted(Action continuation)
{
await this.dispatcher.RunAsync(this.priority, new DispatchedHandler(continuation));
}
}

/// <summary>
/// Yield and allow UI update during tasks.
/// </summary>
/// <param name="dispatcher">Dispatcher of a thread to yield</param>
/// <param name="priority">Dispatcher execution priority, default is low</param>
/// <returns>Awaitable dispatcher task</returns>
public static DispatcherPriorityAwaitable YieldAsync(this CoreDispatcher dispatcher, CoreDispatcherPriority priority = CoreDispatcherPriority.Low)
{
return new DispatcherPriorityAwaitable(dispatcher, priority);
}
}
}
8 changes: 4 additions & 4 deletions Files/Helpers/ThemeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static ElementTheme RootTheme

public static void Initialize()
{
App.AppSettings.AppTheme = new AppTheme();
App.AppSettings.AcrylicTheme = new AcrylicTheme();

// Set TitleBar background color
_TitleBar = ApplicationView.GetForCurrentView().TitleBar;
Expand Down Expand Up @@ -110,19 +110,19 @@ public static void UpdateTheme()
switch (RootTheme)
{
case ElementTheme.Default:
App.AppSettings.AppTheme.SetDefaultTheme();
App.AppSettings.AcrylicTheme.SetDefaultTheme();
_TitleBar.ButtonHoverBackgroundColor = (Color)Application.Current.Resources["SystemBaseLowColor"];
_TitleBar.ButtonForegroundColor = (Color)Application.Current.Resources["SystemBaseHighColor"];
break;

case ElementTheme.Light:
App.AppSettings.AppTheme.SetLightTheme();
App.AppSettings.AcrylicTheme.SetLightTheme();
_TitleBar.ButtonHoverBackgroundColor = Color.FromArgb(51, 0, 0, 0);
_TitleBar.ButtonForegroundColor = Colors.Black;
break;

case ElementTheme.Dark:
App.AppSettings.AppTheme.SetDarkTheme();
App.AppSettings.AcrylicTheme.SetDarkTheme();
_TitleBar.ButtonHoverBackgroundColor = Color.FromArgb(51, 255, 255, 255);
_TitleBar.ButtonForegroundColor = Colors.White;
break;
Expand Down
8 changes: 4 additions & 4 deletions Files/UserControls/ModernSidebar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@
OpenPaneLength="{TemplateBinding OpenPaneLength}">
<SplitView.PaneBackground>
<AcrylicBrush
Windows10version1903:TintLuminosityOpacity="{x:Bind local1:App.AppSettings.AppTheme.TintLuminosityOpacity, Mode=OneWay}"
Windows10version1903:TintLuminosityOpacity="0.9"
BackgroundSource="HostBackdrop"
FallbackColor="{x:Bind local1:App.AppSettings.AppTheme.FallbackColor, Mode=OneWay}"
TintColor="{x:Bind local1:App.AppSettings.AppTheme.TintColor, Mode=OneWay}"
TintOpacity="{x:Bind local1:App.AppSettings.AppTheme.TintOpacity, Mode=OneWay}"
FallbackColor="{x:Bind local1:App.AppSettings.AcrylicTheme.FallbackColor, Mode=OneWay}"
TintColor="{x:Bind local1:App.AppSettings.AcrylicTheme.TintColor, Mode=OneWay}"
TintOpacity="{x:Bind local1:App.AppSettings.AcrylicTheme.TintOpacity, Mode=OneWay}"
AlwaysUseFallback="{x:Bind local1:App.AppSettings.AcrylicEnabled, Mode=OneWay}" />
</SplitView.PaneBackground>
<SplitView.Pane>
Expand Down
30 changes: 26 additions & 4 deletions Files/View Models/ItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

namespace Files.Filesystem
{
public class ItemViewModel : INotifyPropertyChanged
public class ItemViewModel : INotifyPropertyChanged, IDisposable
{
public EmptyFolderTextState EmptyTextState { get; set; } = new EmptyFolderTextState();
public LoadingIndicator LoadIndicator { get; set; } = new LoadingIndicator();
Expand Down Expand Up @@ -448,9 +448,16 @@ public void OrderFiles()
ordered = ordered.ThenByDescending(orderByNameFunc, naturalStringComparer);
}
orderedList = ordered.ToList();
_filesAndFolders.Clear();
foreach (ListedItem i in orderedList)
_filesAndFolders.Add(i);

List<ListedItem> originalList = _filesAndFolders.ToList();
for (var i = 0; i < originalList.Count; i++)
{
if (originalList[i] != orderedList[i])
{
_filesAndFolders.RemoveAt(i);
_filesAndFolders.Insert(i, orderedList[i]);
}
}
}

public static T GetCurrentSelectedTabInstance<T>()
Expand Down Expand Up @@ -742,6 +749,15 @@ public async Task RapidAddItemsToCollectionAsync(string path)
}
}
}
if (_cancellationTokenSource.IsCancellationRequested)
{
break;
}

if (count % 64 == 0)
{
await CoreApplication.MainView.CoreWindow.Dispatcher.YieldAsync();
}
} while (FindNextFile(hFile, out findData));

FindClose(hFile);
Expand All @@ -751,6 +767,7 @@ public async Task RapidAddItemsToCollectionAsync(string path)
{
if (_cancellationTokenSource.IsCancellationRequested)
{
_cancellationTokenSource.Dispose();
_cancellationTokenSource = new CancellationTokenSource();
IsLoadingItems = false;
return;
Expand Down Expand Up @@ -1139,5 +1156,10 @@ private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

public void Dispose()
{
_cancellationTokenSource?.Dispose();
}
}
}
4 changes: 2 additions & 2 deletions Files/View Models/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ private async void LoadTerminalApps()
// await FileIO.WriteTextAsync(file, JsonConvert.SerializeObject(terminalsFileModel, Formatting.Indented));
// }
//}
Terminals = terminalsFileModel.Terminals;
Terminals = terminalsFileModel?.Terminals ?? new List<TerminalModel>();
}

private IList<TerminalModel> _Terminals = null;
Expand Down Expand Up @@ -493,7 +493,7 @@ public bool AcrylicEnabled
ThemeModeChanged?.Invoke(this, EventArgs.Empty);
});

public AppTheme AppTheme { get; set; }
public AcrylicTheme AcrylicTheme { get; set; }

public Int32 LayoutMode
{
Expand Down
8 changes: 4 additions & 4 deletions Files/Views/InstanceTabsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
mc:Ignorable="d">
<Page.Background>
<AcrylicBrush
Windows10version1903:TintLuminosityOpacity="{x:Bind local:App.AppSettings.AppTheme.TintLuminosityOpacity, Mode=OneWay}"
Windows10version1903:TintLuminosityOpacity="0.9"
BackgroundSource="HostBackdrop"
FallbackColor="{x:Bind local:App.AppSettings.AppTheme.FallbackColor, Mode=OneWay}"
TintColor="{x:Bind local:App.AppSettings.AppTheme.TintColor, Mode=OneWay}"
TintOpacity="{x:Bind local:App.AppSettings.AppTheme.TintOpacity, Mode=OneWay}"
FallbackColor="{x:Bind local:App.AppSettings.AcrylicTheme.FallbackColor, Mode=OneWay}"
TintColor="{x:Bind local:App.AppSettings.AcrylicTheme.TintColor, Mode=OneWay}"
TintOpacity="{x:Bind local:App.AppSettings.AcrylicTheme.TintOpacity, Mode=OneWay}"
AlwaysUseFallback="{x:Bind local:App.AppSettings.AcrylicEnabled, Mode=OneWay}" />
</Page.Background>

Expand Down
8 changes: 4 additions & 4 deletions Files/Views/Pages/Properties.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
RequestedTheme="{x:Bind local1:ThemeHelper.RootTheme}">
<Page.Background>
<AcrylicBrush
Windows10version1903:TintLuminosityOpacity="{x:Bind local:App.AppSettings.AppTheme.TintLuminosityOpacity, Mode=OneWay}"
Windows10version1903:TintLuminosityOpacity="0.9"
BackgroundSource="HostBackdrop"
FallbackColor="{x:Bind local:App.AppSettings.AppTheme.FallbackColor, Mode=OneWay}"
TintColor="{x:Bind local:App.AppSettings.AppTheme.TintColor, Mode=OneWay}"
TintOpacity="{x:Bind local:App.AppSettings.AppTheme.TintOpacity, Mode=OneWay}"
FallbackColor="{x:Bind local:App.AppSettings.AcrylicTheme.FallbackColor, Mode=OneWay}"
TintColor="{x:Bind local:App.AppSettings.AcrylicTheme.TintColor, Mode=OneWay}"
TintOpacity="{x:Bind local:App.AppSettings.AcrylicTheme.TintOpacity, Mode=OneWay}"
AlwaysUseFallback="{x:Bind local:App.AppSettings.AcrylicEnabled, Mode=OneWay}" />
</Page.Background>
<Grid>
Expand Down
10 changes: 2 additions & 8 deletions builds/azure-pipelines-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ steps:
$xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files UWP - Preview"
$xmlDoc.Save('$(Build.SourcesDirectory)\Files.Package\Package.appxmanifest')
failOnStderr: true

- task: DownloadSecureFile@1
name: signingCert
displayName: 'Download Files UWP build certificate'
inputs:
secureFile: 'Certificate.pfx'


- task: NuGetToolInstaller@1

- task: NuGetCommand@2
Expand All @@ -39,7 +33,7 @@ steps:
platform: 'x86'
solution: '**/*.wapproj'
configuration: '$(buildConfiguration)'
msbuildArguments: '/t:build;_GenerateAppxPackage /p:Configuration=Release;Platform="$(buildPlatform)";AppxBundle=Always;AppxBundlePlatforms="$(buildPlatform)" /p:PackageCertificateKeyFile="$(signingCert.secureFilePath)"'
msbuildArguments: '/t:build;_GenerateAppxPackage /p:Configuration=Release;Platform="$(buildPlatform)";AppxBundle=Always;AppxBundlePlatforms="$(buildPlatform)"'

- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
Expand Down
Loading