Skip to content

Commit 3f7df72

Browse files
authored
Cleaned up code (#1295)
1 parent 087825d commit 3f7df72

35 files changed

+468
-322
lines changed

Common/ShellFileItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public ShellFileItem()
1818
}
1919

2020
public ShellFileItem(
21-
bool isFolder, string recyclePath, string fileName, string filePath,
21+
bool isFolder, string recyclePath, string fileName, string filePath,
2222
DateTime recycleDate, string fileSize, ulong fileSizeBytes, string fileType)
2323
{
2424
this.IsFolder = isFolder;

Files.Launcher/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ private static async Task parseArguments(AppServiceRequestReceivedEventArgs args
239239
await args.Request.SendResponseAsync(new ValueSet() { { "Bitlocker", "Unlock" } });
240240
}
241241
break;
242+
242243
default:
243244
if (args.Request.Message.ContainsKey("Application"))
244245
{
@@ -487,4 +488,4 @@ private static void Connection_ServiceClosed(AppServiceConnection sender, AppSer
487488
appServiceExit.Set();
488489
}
489490
}
490-
}
491+
}

Files.Launcher/Win32API.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.ComponentModel;
44
using System.Diagnostics;
5-
using System.Drawing;
65
using System.Linq;
76
using System.Runtime.InteropServices;
87
using System.Text;

Files/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,4 +427,4 @@ public class WSLDistroItem : INavigationControlItem
427427
public NavigationControlItemType ItemType => NavigationControlItemType.LinuxDistro;
428428
public Uri Logo { get; set; }
429429
}
430-
}
430+
}

Files/BaseLayout.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ private async void MenuLayoutItem_Click(object sender, RoutedEventArgs e)
322322

323323
public void RightClickItemContextMenu_Opening(object sender, object e)
324324
{
325-
326325
SetShellContextmenu();
327326
var selectedFileSystemItems = App.CurrentInstance.ContentPage.SelectedItems;
328327

Files/DataModels/SidebarPinnedModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public async void AddItemToSidebar(string path)
7070
try
7171
{
7272
StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(path);
73-
int insertIndex = App.sideBarItems.IndexOf(App.sideBarItems.Last(x => x.ItemType == NavigationControlItemType.Location
73+
int insertIndex = App.sideBarItems.IndexOf(App.sideBarItems.Last(x => x.ItemType == NavigationControlItemType.Location
7474
&& !x.Path.Equals(App.AppSettings.RecycleBinPath))) + 1;
7575
var locationItem = new LocationItem
7676
{

Files/Dialogs/AddItemDialog.xaml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,41 @@
22
x:Class="Files.Dialogs.AddItemDialog"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:Files.Dialogs"
5+
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:local="using:Files.Dialogs"
78
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8-
mc:Ignorable="d"
9-
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
10-
CornerRadius="4" Title="Create a New Item" Grid.RowSpan="4" BorderThickness="0" x:Name="AddDialog" PrimaryButtonText="Cancel">
9+
x:Name="AddDialog"
10+
Title="Create a New Item"
11+
Grid.RowSpan="4"
12+
BorderThickness="0"
13+
CornerRadius="4"
14+
PrimaryButtonText="Cancel"
15+
mc:Ignorable="d">
1116

12-
<StackPanel Spacing="25" Orientation="Vertical">
17+
<StackPanel Orientation="Vertical" Spacing="25">
1318
<Grid x:Name="SubtitleArea">
1419
<TextBlock x:Name="Description" Text="Choose a type for this new item below" />
1520
</Grid>
1621
<Grid x:Name="SelectionListContent" HorizontalAlignment="Stretch">
1722
<StackPanel>
18-
<ListView Width="400" SelectionMode="None" x:Name="AddItemsListView" IsItemClickEnabled="True" ItemClick="ListView_ItemClick" ItemsSource="{x:Bind AddItemsList}">
23+
<ListView
24+
x:Name="AddItemsListView"
25+
Width="400"
26+
IsItemClickEnabled="True"
27+
ItemClick="ListView_ItemClick"
28+
ItemsSource="{x:Bind AddItemsList}"
29+
SelectionMode="None">
1930
<ListView.ItemTemplate>
2031
<DataTemplate x:DataType="local:AddListItem">
2132
<Grid Height="50">
22-
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
23-
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="28" Text="{x:Bind Icon}" Margin="0,0,10,0" VerticalAlignment="Center" />
33+
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
34+
<TextBlock
35+
Margin="0,0,10,0"
36+
VerticalAlignment="Center"
37+
FontFamily="Segoe MDL2 Assets"
38+
FontSize="28"
39+
Text="{x:Bind Icon}" />
2440
<StackPanel>
2541
<TextBlock Text="{x:Bind Header}" />
2642
<TextBlock Foreground="Gray" Text="{x:Bind SubHeader}" />

Files/Dialogs/BitlockerDialog.xaml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
x:Class="Files.Dialogs.BitlockerDialog"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local2="using:Files.Helpers"
65
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local2="using:Files.Helpers"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8-
mc:Ignorable="d"
9-
CornerRadius="4"
10-
DefaultButton="None"
8+
x:Name="BitlockerDriveDialog"
9+
x:Uid="BitlockerDialog"
1110
Title="Enter password to unlock the drive"
1211
BorderThickness="0"
12+
CornerRadius="4"
13+
DefaultButton="None"
1314
PrimaryButtonClick="BitlockerDialog_PrimaryButtonClick"
14-
x:Name="BitlockerDriveDialog"
1515
PrimaryButtonText="Unlock"
16+
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}"
1617
SecondaryButtonText="Cancel"
17-
x:Uid="BitlockerDialog"
18-
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}">
18+
mc:Ignorable="d">
1919

2020
<ContentDialog.PrimaryButtonStyle>
21-
<Style TargetType="Button" BasedOn="{StaticResource AccentButtonStyle}">
21+
<Style BasedOn="{StaticResource AccentButtonStyle}" TargetType="Button">
2222
<Setter Property="ContentTemplate">
2323
<Setter.Value>
2424
<DataTemplate x:DataType="Button">
25-
<StackPanel Spacing="5" Orientation="Horizontal">
25+
<StackPanel Orientation="Horizontal" Spacing="5">
2626
<FontIcon FontSize="14" Glyph="&#xEA18;" />
2727
<TextBlock Text="{Binding PrimaryButtonText, ElementName=BitlockerDriveDialog}" />
2828
</StackPanel>
@@ -31,19 +31,17 @@
3131
</Setter>
3232
</Style>
3333
</ContentDialog.PrimaryButtonStyle>
34-
34+
3535
<Grid MinWidth="300">
36-
<StackPanel
37-
Orientation="Vertical"
38-
Spacing="4">
39-
<PasswordBox
36+
<StackPanel Orientation="Vertical" Spacing="4">
37+
<PasswordBox
4038
x:Name="PasswordInput"
4139
x:Uid="BitlockerDialogInputText"
42-
PlaceholderText="Password"
4340
Height="35"
4441
IsPasswordRevealButtonEnabled="True"
42+
PasswordChanged="BitlockerInput_TextChanged"
4543
PasswordRevealMode="Peek"
46-
PasswordChanged="BitlockerInput_TextChanged" />
44+
PlaceholderText="Password" />
4745
</StackPanel>
4846
</Grid>
4947
</ContentDialog>

Files/Dialogs/ConsentDialog.xaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@
22
x:Class="Files.Dialogs.ConsentDialog"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local2="using:Files.Helpers"
65
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local2="using:Files.Helpers"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8-
mc:Ignorable="d"
9-
CornerRadius="4"
8+
x:Name="PermissionDialog"
9+
x:Uid="WelcomeDialog"
10+
Title="Welcome to Files"
1011
Grid.RowSpan="4"
12+
CornerRadius="4"
1113
DefaultButton="Primary"
1214
PrimaryButtonClick="PermissionDialog_PrimaryButtonClick"
1315
PrimaryButtonText="Grant Permission"
14-
x:Name="PermissionDialog"
15-
Title="Welcome to Files"
16-
x:Uid="WelcomeDialog"
17-
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}">
16+
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}"
17+
mc:Ignorable="d">
1818

1919
<Grid>
20-
<TextBlock x:Uid="WelcomeDialogTextBlock"
21-
TextWrapping="WrapWholeWords"
22-
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. " />
20+
<TextBlock
21+
x:Uid="WelcomeDialogTextBlock"
22+
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. "
23+
TextWrapping="WrapWholeWords" />
2324
</Grid>
2425
</ContentDialog>

Files/Dialogs/ExceptionDialog.xaml

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,60 @@
22
x:Class="Files.Dialogs.ExceptionDialog"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local2="using:Files.Helpers"
65
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local2="using:Files.Helpers"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8-
mc:Ignorable="d"
98
Title="We didn't expect that"
10-
PrimaryButtonText="Close Tab"
11-
SecondaryButtonText="Exit App"
12-
CornerRadius="4"
139
CloseButtonText="Ignore"
10+
CornerRadius="4"
1411
DefaultButton="Primary"
12+
Loaded="ContentDialog_Loaded"
1513
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
14+
PrimaryButtonText="Close Tab"
15+
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}"
1616
SecondaryButtonClick="ContentDialog_SecondaryButtonClick"
17-
Loaded="ContentDialog_Loaded"
18-
RequestedTheme="{x:Bind local2:ThemeHelper.RootTheme}">
17+
SecondaryButtonText="Exit App"
18+
mc:Ignorable="d">
1919

2020
<Grid>
21-
<StackPanel Spacing="5" Orientation="Vertical">
22-
<TextBlock TextWrapping="Wrap" Text="Files ran into a problem that the developers didn't prepare for yet. Please select one of the options below, and report the problem from File > Settings > About" />
23-
<Button x:Name="ExpandMoreInfo" Click="ExpandMoreInfo_Click" Padding="0" Background="Transparent">
21+
<StackPanel Orientation="Vertical" Spacing="5">
22+
<TextBlock Text="Files ran into a problem that the developers didn't prepare for yet. Please select one of the options below, and report the problem from File &gt; Settings &gt; About" TextWrapping="Wrap" />
23+
<Button
24+
x:Name="ExpandMoreInfo"
25+
Padding="0"
26+
Background="Transparent"
27+
Click="ExpandMoreInfo_Click">
2428
<Button.Content>
25-
<StackPanel Spacing="5" Orientation="Horizontal">
26-
<FontIcon x:Name="ExpandIcon" FontSize="14" Glyph="&#xE70D;" />
27-
<FontIcon x:Name="CollapseIcon" Visibility="Collapsed" FontSize="14" Glyph="&#xE70E;" />
29+
<StackPanel Orientation="Horizontal" Spacing="5">
30+
<FontIcon
31+
x:Name="ExpandIcon"
32+
FontSize="14"
33+
Glyph="&#xE70D;" />
34+
<FontIcon
35+
x:Name="CollapseIcon"
36+
FontSize="14"
37+
Glyph="&#xE70E;"
38+
Visibility="Collapsed" />
2839
<TextBlock FontWeight="Bold" Text="More information" />
2940
</StackPanel>
3041
</Button.Content>
3142
</Button>
32-
<ScrollViewer x:Name="TechnicalInformation" Visibility="Collapsed" MaxHeight="250">
43+
<ScrollViewer
44+
x:Name="TechnicalInformation"
45+
MaxHeight="250"
46+
Visibility="Collapsed">
3347
<Grid>
3448
<StackPanel Orientation="Vertical">
3549
<TextBlock IsTextSelectionEnabled="True" Text="Friendly Description:" />
36-
<TextBlock IsTextSelectionEnabled="True" TextWrapping="Wrap" x:Name="Summary" />
50+
<TextBlock
51+
x:Name="Summary"
52+
IsTextSelectionEnabled="True"
53+
TextWrapping="Wrap" />
3754
<TextBlock IsTextSelectionEnabled="True" Text="Technical Information:" />
38-
<TextBlock IsTextSelectionEnabled="True" TextWrapping="Wrap" x:Name="ErrorInfo" />
55+
<TextBlock
56+
x:Name="ErrorInfo"
57+
IsTextSelectionEnabled="True"
58+
TextWrapping="Wrap" />
3959
</StackPanel>
4060
</Grid>
4161
</ScrollViewer>

0 commit comments

Comments
 (0)