Skip to content

Commit 36c1d53

Browse files
Luke BlevinsLuke Blevins
authored andcommitted
Add ClassicMode Layout
1 parent bcdd71f commit 36c1d53

9 files changed

+178
-11
lines changed

AddItem.xaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<Page
2+
x:Class="Files.AddItem"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:Files"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d"
9+
Background="{ThemeResource SystemControlAcrylicWindowBrush}" Loaded="Page_Loaded">
10+
11+
<Grid Padding="25,50,25,0">
12+
<StackPanel Spacing="25" Orientation="Vertical">
13+
<Grid Name="HeaderArea">
14+
<StackPanel>
15+
<TextBlock Name="Heading" Text="Create New Item" FontSize="36" FontWeight="Bold"/>
16+
<TextBlock Name="Description" Text="Choose a type below for this new item."/>
17+
</StackPanel>
18+
</Grid>
19+
<Grid Name="SelectionListContent" HorizontalAlignment="Left">
20+
<StackPanel>
21+
<ListView IsItemClickEnabled="True" ItemClick="ListView_ItemClick" ItemsSource="{x:Bind local:AddItem.AddItemsList}">
22+
<ListView.ItemTemplate>
23+
<DataTemplate>
24+
<StackPanel>
25+
<TextBlock Text="{Binding Header}"/>
26+
<TextBlock Foreground="Gray" Text="{Binding SubHeader}"/>
27+
</StackPanel>
28+
</DataTemplate>
29+
</ListView.ItemTemplate>
30+
</ListView>
31+
</StackPanel>
32+
</Grid>
33+
</StackPanel>
34+
</Grid>
35+
</Page>

AddItem.xaml.cs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using Windows.Foundation;
7+
using Windows.Foundation.Collections;
8+
using Windows.UI.ViewManagement;
9+
using Windows.UI.Xaml;
10+
using Windows.UI.Xaml.Controls;
11+
using Windows.UI.Xaml.Controls.Primitives;
12+
using Windows.UI.Xaml.Data;
13+
using Windows.UI.Xaml.Input;
14+
using Windows.UI.Xaml.Media;
15+
using Windows.UI.Xaml.Navigation;
16+
17+
18+
19+
namespace Files
20+
{
21+
22+
public sealed partial class AddItem : Page
23+
{
24+
public AddItem()
25+
{
26+
this.InitializeComponent();
27+
AddItemsToList();
28+
}
29+
30+
public static List<AddListItem> AddItemsList = new List<AddListItem>();
31+
32+
public static void AddItemsToList()
33+
{
34+
AddItemsList.Clear();
35+
AddItemsList.Add(new AddListItem { Header = "Folder", SubHeader = "Creates an empty folder.", isEnabled = true });
36+
AddItemsList.Add(new AddListItem { Header = "Text Document", SubHeader = "Creates a simple file for text input", isEnabled = true });
37+
AddItemsList.Add(new AddListItem { Header = "Bitmap Image", SubHeader = "Creates an empty bitmap image file.", isEnabled = true });
38+
AddItemsList.Add(new AddListItem { Header = "Shortcut", SubHeader = "In Development: Creates a shortcut to a different location.", isEnabled = false });
39+
AddItemsList.Add(new AddListItem { Header = "Compressed Folder", SubHeader = "In Development: Creates a new compressed folder from an existing folder.", isEnabled = false });
40+
}
41+
42+
43+
private void ListView_ItemClick(object sender, ItemClickEventArgs e)
44+
{
45+
46+
}
47+
48+
private void Page_Loaded(object sender, RoutedEventArgs e)
49+
{
50+
51+
}
52+
}
53+
54+
public class AddListItem
55+
{
56+
public string Header { get; set; }
57+
public string SubHeader { get; set; }
58+
59+
public bool isEnabled { get; set; }
60+
}
61+
}

ClassicMode.xaml

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,61 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:local="using:Files"
6+
xmlns:local1="using:ItemListPresenter"
67
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
78
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
10+
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
811
mc:Ignorable="d"
12+
Name="ClassicModePage"
913
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
1014

1115
<Grid>
12-
<SplitView IsPaneOpen="True">
16+
<Grid.RowDefinitions>
17+
<RowDefinition Height="Auto"/>
18+
<RowDefinition Height="92*"/>
19+
</Grid.RowDefinitions>
20+
21+
<Grid Background="{StaticResource SystemControlAcrylicWindowMediumHighBrush}" Grid.Row="0" Name="TopBar">
22+
<Grid.ColumnDefinitions>
23+
<ColumnDefinition Width="Auto"/>
24+
<ColumnDefinition Width="*"/>
25+
</Grid.ColumnDefinitions>
26+
<Grid.RowDefinitions>
27+
<RowDefinition Height="Auto"/>
28+
<RowDefinition Height="*"/>
29+
</Grid.RowDefinitions>
30+
<Windows10version1809:MenuBar HorizontalAlignment="Left" VerticalAlignment="Stretch">
31+
<MenuBar.Items>
32+
<MenuBarItem Title="File">
33+
<MenuFlyoutItem Text="Open"/>
34+
</MenuBarItem>
35+
</MenuBar.Items>
36+
</Windows10version1809:MenuBar>
37+
<Grid Name="DragArea" Background="Transparent" Height="40" Grid.Column="1">
38+
39+
</Grid>
40+
41+
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="2">
42+
<ComboBox SelectedIndex="0" BorderThickness="1" VerticalAlignment="Center" Width="200" Margin="10,0,10,0">
43+
<ComboBoxItem>
44+
<StackPanel Orientation="Horizontal">
45+
<TextBlock Margin="0,0,5,0" VerticalAlignment="Center" FontFamily="Segoe MDL2 Assets" Text="&#xEDA2;"/>
46+
<TextBlock Text="Drive C:"/>
47+
</StackPanel>
48+
</ComboBoxItem>
49+
</ComboBox>
50+
<Button Background="{x:Null}" ToolTipService.ToolTip="Only show item icons and their respective names" FontFamily="Segoe MDL2 Assets" Content="&#xF0E2;" VerticalAlignment="Stretch" Width="46"/>
51+
</StackPanel>
52+
</Grid>
53+
54+
<SplitView DisplayMode="Inline" IsPaneOpen="True" HorizontalAlignment="Stretch" Margin="0,0,0,0" Grid.RowSpan="1" Grid.Row="1" VerticalAlignment="Stretch">
1355
<SplitView.Pane>
14-
<Grid>
15-
<TreeView Name="DirectoryView">
56+
<Grid Background="{StaticResource SystemControlAcrylicWindowMediumHighBrush}">
57+
<TreeView Windows10version1809:ItemsSource="{x:Bind local1:ItemViewModel.FilesAndFolders}" Name="DirectoryView">
1658

17-
18-
59+
60+
1961
</TreeView>
2062
</Grid>
2163
</SplitView.Pane>

ClassicMode.xaml.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
using ItemListPresenter;
2+
using System;
23
using System.Collections.Generic;
34
using System.IO;
45
using System.Linq;
@@ -25,15 +26,19 @@ namespace Files
2526
/// </summary>
2627
public sealed partial class ClassicMode : Page
2728
{
29+
public static Page ClassicView;
2830
public ClassicMode()
2931
{
3032
this.InitializeComponent();
3133
var CoreTitleBar = CoreApplication.GetCurrentView().TitleBar;
34+
Window.Current.SetTitleBar(DragArea);
3235
CoreTitleBar.ExtendViewIntoTitleBar = true;
3336
var titleBar = ApplicationView.GetForCurrentView().TitleBar;
34-
titleBar.ButtonBackgroundColor = Color.FromArgb(100, 255, 255, 255);
37+
titleBar.ButtonBackgroundColor = Color.FromArgb(0, 255, 255, 255);
3538
titleBar.ButtonHoverBackgroundColor = Color.FromArgb(75, 10, 10, 10);
3639
titleBar.ButtonHoverBackgroundColor = Color.FromArgb(75, 10, 10, 10);
40+
ClassicView = this.ClassicModePage;
41+
//ItemViewModel viewModel = new ItemViewModel(@"C:\", ClassicView);
3742
}
3843
}
3944
}

FileLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static ProgressUIVisibility PVIS
123123
public ItemViewModel(string ViewPath, Page p)
124124
{
125125
// Personalize retrieved items for view they are displayed in
126-
if(p.Name == "GenericItemView")
126+
if(p.Name == "GenericItemView" || p.Name == "ClassicView")
127127
{
128128
isPhotoAlbumMode = false;
129129
}

Files.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@
102102
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
103103
</PropertyGroup>
104104
<ItemGroup>
105+
<Compile Include="AddItem.xaml.cs">
106+
<DependentUpon>AddItem.xaml</DependentUpon>
107+
</Compile>
105108
<Compile Include="App.xaml.cs">
106109
<DependentUpon>App.xaml</DependentUpon>
107110
</Compile>
@@ -207,6 +210,10 @@
207210
<Generator>MSBuild:Compile</Generator>
208211
<SubType>Designer</SubType>
209212
</ApplicationDefinition>
213+
<Page Include="AddItem.xaml">
214+
<SubType>Designer</SubType>
215+
<Generator>MSBuild:Compile</Generator>
216+
</Page>
210217
<Page Include="ClassicMode.xaml">
211218
<SubType>Designer</SubType>
212219
<Generator>MSBuild:Compile</Generator>

GenericFileBrowser.xaml.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using Windows.ApplicationModel.DataTransfer;
2323
using Windows.Storage;
2424
using Windows.UI;
25+
using Windows.UI.Core;
2526
using Windows.UI.ViewManagement;
2627
using Windows.UI.Xaml;
2728
using Windows.UI.Xaml.Controls;
@@ -68,6 +69,7 @@ public GenericFileBrowser()
6869
Back.Click += Navigation.NavigationActions.Back_Click;
6970
Forward.Click += Navigation.NavigationActions.Forward_Click;
7071
Refresh.Click += Navigation.NavigationActions.Refresh_Click;
72+
AddItem.Click += AddItem_ClickAsync;
7173
AllView.DoubleTapped += Interacts.Interaction.List_ItemClick;
7274
Paste.Click += Interacts.Interaction.PasteItem_ClickAsync;
7375
Clipboard.ContentChanged += Clipboard_ContentChanged;
@@ -76,6 +78,24 @@ public GenericFileBrowser()
7678
SkipChoice.Click += Interacts.Interaction.SkipChoiceClick;
7779
}
7880

81+
private async void AddItem_ClickAsync(object sender, RoutedEventArgs e)
82+
{
83+
var CurrentView = ApplicationView.GetForCurrentView();
84+
CoreApplicationView NewView = CoreApplication.CreateNewView();
85+
86+
await NewView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
87+
{
88+
var newWindow = Window.Current;
89+
var newAppView = ApplicationView.GetForCurrentView();
90+
Frame frame = new Frame();
91+
frame.Navigate(typeof(AddItem), null);
92+
Window.Current.Content = frame;
93+
Window.Current.Activate();
94+
await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newAppView.Id, ViewSizePreference.Default, CurrentView.Id, ViewSizePreference.Default);
95+
96+
});
97+
}
98+
7999
private void Clipboard_ContentChanged(object sender, object e)
80100
{
81101
DataPackageView packageView = Clipboard.GetContent();

LocationsList.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public static void DisplayItems()
2929
itemsAdded.Add(new LocationItem() { ImageSource = "Assets/Cards/Gradients/Orange.png", Icon = "\xEB9F", Text = "Pictures" });
3030
itemsAdded.Add(new LocationItem() { ImageSource = "Assets/Cards/Gradients/Pink.png", Icon = "\xEC4F", Text = "Music" });
3131
itemsAdded.Add(new LocationItem() { ImageSource = "Assets/Cards/Gradients/Red.png", Icon = "\xE8B2", Text = "Videos" });
32-
// Eventually, pull dominant color from image and style dropshadowpanel accordingly
3332

3433

3534

YourHome.xaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
x:Class="Files.YourHome"
1515
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
1616
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
17-
xmlns:local="using:Files"
1817
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
1918
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
2019
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
2120
xmlns:list="using:Locations"
22-
xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
2321
mc:Ignorable="d">
2422
<Page.Resources>
2523
<RevealBackgroundBrush x:Key="CardHoverBackground" TargetTheme="Dark" />

0 commit comments

Comments
 (0)