Skip to content
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
35 changes: 6 additions & 29 deletions Files/App.xaml
Original file line number Diff line number Diff line change
@@ -1,53 +1,28 @@
<Application
<Application
x:Class="Files.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)">
xmlns:converters="using:Files.Helpers">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<ResourceDictionary Source="/ResourceDictionaries/ToolbarButtonStyle.xaml" />
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="NavigationViewDefaultPaneBackground" Color="White" />
<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="White" />
<AcrylicBrush
x:Key="BackgroundAcrylicBrush"
Windows10version1903:TintLuminosityOpacity="0.9"
BackgroundSource="HostBackdrop"
FallbackColor="{StaticResource SystemListLowColor}"
TintColor="White"
TintOpacity="0.9" />
<SolidColorBrush x:Key="RibbonBackgroundColor" Color="White" />
<StaticResource x:Key="NavigationViewTopPaneBackground" ResourceKey="RibbonBackgroundColor" />
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<AcrylicBrush
x:Key="BackgroundAcrylicBrush"
Windows10version1903:TintLuminosityOpacity="0.9"
BackgroundSource="HostBackdrop"
FallbackColor="{StaticResource SystemChromeWhiteColor}"
TintColor="White"
TintOpacity="0.9" />
<SolidColorBrush x:Key="NavigationViewDefaultPaneBackground" Color="White" />
<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="White" />
<SolidColorBrush x:Key="UnmodifiedSystemPageColor" Color="White" />
<SolidColorBrush x:Key="YourHomeCardBackgroundColor" Color="#f3f1ef" />
<SolidColorBrush x:Key="YourHomeCardBorderColor" Color="#f3f1ef" />
<SolidColorBrush x:Key="TabViewBackground" Color="White" />
<SolidColorBrush x:Key="CustomInputFieldBorderBrush" Color="DarkGray" />
<SolidColorBrush x:Key="RibbonBackgroundColor" Color="White" />
<StaticResource x:Key="NavigationViewTopPaneBackground" ResourceKey="RibbonBackgroundColor" />
<SolidColorBrush x:Key="SystemControlPageBackgroundMediumAltMediumBrush" Color="#99000000" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<AcrylicBrush
x:Key="BackgroundAcrylicBrush"
Windows10version1903:TintLuminosityOpacity="0.9"
BackgroundSource="HostBackdrop"
FallbackColor="{StaticResource SystemListLowColor}"
TintColor="Black"
TintOpacity="0.7" />
<SolidColorBrush x:Key="NavigationViewDefaultPaneBackground" Color="#191919" />
<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="#191919" />
<SolidColorBrush x:Key="ApplicationPageBackgroundThemeBrush" Color="#191919" />
Expand All @@ -62,13 +37,15 @@
<!--<SolidColorBrush x:Key="TextControlBorderBrush" Color="#FF363636" />-->
<SolidColorBrush x:Key="RibbonBackgroundColor" Color="#131313" />
<StaticResource x:Key="NavigationViewTopPaneBackground" ResourceKey="RibbonBackgroundColor" />
<SolidColorBrush x:Key="SystemControlPageBackgroundMediumAltMediumBrush" Color="#99000000" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<!-- This empty dictionary ensures that the default high contrast resources are used when the user turns on high contrast mode. -->
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<converters:NegateConverter x:Key="NegateConverter" />
</ResourceDictionary>
</Application.Resources>
</Application>
7 changes: 3 additions & 4 deletions Files/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Files.CommandLine;
using Files.CommandLine;
using Files.Controls;
using Files.Filesystem;
using Files.Helpers;
using Files.Interacts;
using Files.View_Models;
using Microsoft.AppCenter;
Expand All @@ -11,16 +12,13 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.DataTransfer;
using Windows.Storage;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;

Expand Down Expand Up @@ -202,6 +200,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
rootFrame.Navigate(typeof(InstanceTabsView), e.Arguments, new SuppressNavigationTransitionInfo());
}

ThemeHelper.Initialize();
// Ensure the current window is active
Window.Current.Activate();
Window.Current.CoreWindow.PointerPressed += CoreWindow_PointerPressed;
Expand Down
6 changes: 3 additions & 3 deletions Files/Dialogs/ConfirmDeleteDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
x:Class="Files.Dialogs.ConfirmDeleteDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Files.Dialogs"
xmlns:local1="using:Files"
xmlns:local2="using:Files.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Uid="ConfirmDeleteDialog"
Title="Delete Item(s)"
CornerRadius="4"
mc:Ignorable="d">
mc:Ignorable="d"
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}">

<Grid>
<Grid.RowDefinitions>
Expand Down
17 changes: 13 additions & 4 deletions Files/Dialogs/ConsentDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@
x:Class="Files.Dialogs.ConsentDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Files.Dialogs"
xmlns:local2="using:Files.Helpers"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
CornerRadius="4" Grid.RowSpan="4" DefaultButton="Primary" PrimaryButtonClick="PermissionDialog_PrimaryButtonClick" PrimaryButtonText="Grant Permission" x:Name="PermissionDialog" Title="Welcome to Files" x:Uid="WelcomeDialog">
CornerRadius="4"
Grid.RowSpan="4"
DefaultButton="Primary"
PrimaryButtonClick="PermissionDialog_PrimaryButtonClick"
PrimaryButtonText="Grant Permission"
x:Name="PermissionDialog"
Title="Welcome to Files"
x:Uid="WelcomeDialog"
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}">

<Grid>
<TextBlock x:Uid="WelcomeDialogTextBlock" TextWrapping="WrapWholeWords" Text="To get started, you'll need to grant us permission to display your files. This will open a Settings page where you can grant us this permission. You'll need to reopen the app once completed. " />
<TextBlock x:Uid="WelcomeDialogTextBlock"
TextWrapping="WrapWholeWords"
Text="To get started, you'll need to grant us permission to display your files. This will open a Settings page where you can grant us this permission. You'll need to reopen the app once completed. " />
</Grid>
</ContentDialog>
6 changes: 4 additions & 2 deletions Files/Dialogs/ExceptionDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
x:Class="Files.Dialogs.ExceptionDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Files.Dialogs"
xmlns:local2="using:Files.Helpers"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Expand All @@ -13,7 +13,9 @@
CloseButtonText="Ignore"
DefaultButton="Primary"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
SecondaryButtonClick="ContentDialog_SecondaryButtonClick" Loaded="ContentDialog_Loaded">
SecondaryButtonClick="ContentDialog_SecondaryButtonClick"
Loaded="ContentDialog_Loaded"
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}">

<Grid>
<StackPanel Spacing="5" Orientation="Vertical">
Expand Down
5 changes: 3 additions & 2 deletions Files/Dialogs/ExtractFilesDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Files.Dialogs"
xmlns:local2="using:Files.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Uid="ExtractFilesDialog"
Title="Extract Compressed Archive"
Expand All @@ -13,7 +13,8 @@
DefaultButton="Primary"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
PrimaryButtonText="Extract"
mc:Ignorable="d">
mc:Ignorable="d"
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}">

<Grid MinWidth="375">
<StackPanel Orientation="Vertical">
Expand Down
6 changes: 3 additions & 3 deletions Files/Dialogs/PropertiesDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
x:Class="Files.Dialogs.PropertiesDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Files.Dialogs"
xmlns:local2="using:Files.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="PropertiesDialogMarkup"
Title="Properties"
CornerRadius="4"
mc:Ignorable="d">
mc:Ignorable="d"
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}">

<Frame
x:Name="propertiesFrame"
Expand Down
20 changes: 16 additions & 4 deletions Files/Dialogs/RenameDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@
x:Class="Files.Dialogs.RenameDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Files.Dialogs"
xmlns:local2="using:Files.Helpers"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
CornerRadius="4" Grid.RowSpan="4" DefaultButton="Primary" Title="Enter an item name" BorderThickness="0" PrimaryButtonClick="NameDialog_PrimaryButtonClick" x:Name="NameDialog" PrimaryButtonText="Set Name" SecondaryButtonText="Cancel" x:Uid="RenameDialog">
CornerRadius="4"
Grid.RowSpan="4"
DefaultButton="Primary"
Title="Enter an item name"
BorderThickness="0"
PrimaryButtonClick="NameDialog_PrimaryButtonClick"
x:Name="NameDialog"
PrimaryButtonText="Set Name"
SecondaryButtonText="Cancel"
x:Uid="RenameDialog"
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}">

<Grid MinWidth="300">
<TextBox x:Name="RenameInput" x:Uid="RenameDialogInputText" PlaceholderText="Enter an item name without an extension" Height="35" />
<TextBox x:Name="RenameInput"
x:Uid="RenameDialogInputText"
PlaceholderText="Enter an item name without an extension"
Height="35" />
</Grid>
</ContentDialog>
9 changes: 0 additions & 9 deletions Files/Enums/ThemeStyle.cs

This file was deleted.

4 changes: 3 additions & 1 deletion Files/Files.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,11 @@
<Compile Include="Dialogs\ConfirmDeleteDialog.xaml.cs">
<DependentUpon>ConfirmDeleteDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Helpers\AppTheme.cs" />
<Compile Include="Helpers\ItemsDataTemplateSelector.cs" />
<Compile Include="Helpers\NaturalStringComparer.cs" />
<Compile Include="Helpers\NegateConverter.cs" />
<Compile Include="Helpers\ThemeHelper.cs" />
<Compile Include="ResourceController.cs" />
<Compile Include="UserControls\NavigationToolbar\INavigationToolbar.cs" />
<Compile Include="UserControls\NavigationToolbar\ModernNavigationToolbar.xaml.cs">
Expand Down Expand Up @@ -185,7 +188,6 @@
<Compile Include="Enums\FormFactorMode.cs" />
<Compile Include="Enums\SidebarOpacity.cs" />
<Compile Include="Enums\SortOption.cs" />
<Compile Include="Enums\ThemeStyle.cs" />
<Compile Include="Enums\TimeStyle.cs" />
<Compile Include="Filesystem\DriveItem.cs" />
<Compile Include="Filesystem\Drives.cs" />
Expand Down
90 changes: 90 additions & 0 deletions Files/Helpers/AppTheme.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.UI;
using Windows.UI.Xaml;

namespace Files.Helpers
{
public class AppTheme : 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; }
set
{
_FallbackColor = value;
NotifyPropertyChanged("FallbackColor");
}
}

public Color TintColor
{
get { return _TintColor; }
set
{
_TintColor = value;
NotifyPropertyChanged("TintColor");
}
}

public double TintOpacity
{
get { return _TintOpacity; }
set
{
_TintOpacity = value;
NotifyPropertyChanged("TintOpacity");
}
}

public event PropertyChangedEventHandler PropertyChanged;

private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

public AppTheme()
{
}

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;
}
}
}
28 changes: 28 additions & 0 deletions Files/Helpers/NegateConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using Windows.UI.Xaml.Data;

namespace Files.Helpers
{
public class NegateConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (targetType != typeof(bool))
{
throw new InvalidOperationException("The target must be a boolean");
}

return !(bool)value;
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (targetType != typeof(bool))
{
throw new InvalidOperationException("The target must be a boolean");
}

return !(bool)value;
}
}
}
Loading