Skip to content

Commit 9be62ff

Browse files
committed
Begin work for an "add item" experience
1 parent 6a4c3a0 commit 9be62ff

File tree

4 files changed

+34
-24
lines changed

4 files changed

+34
-24
lines changed

AddItem.xaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,27 @@
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
88
mc:Ignorable="d"
9-
Background="{ThemeResource SystemControlAcrylicWindowBrush}" Loaded="Page_Loaded">
9+
Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Loaded="Page_Loaded">
1010

11-
<Grid Padding="25,50,25,0">
11+
<Grid>
1212
<StackPanel Spacing="25" Orientation="Vertical">
1313
<Grid Name="HeaderArea">
1414
<StackPanel>
1515
<TextBlock Name="Heading" Text="Create New Item" FontSize="36" FontWeight="Bold"/>
1616
<TextBlock Name="Description" Text="Choose a type below for this new item."/>
1717
</StackPanel>
1818
</Grid>
19-
<Grid Name="SelectionListContent" HorizontalAlignment="Left">
19+
<Grid Name="SelectionListContent" HorizontalAlignment="Stretch">
2020
<StackPanel>
2121
<ListView IsItemClickEnabled="True" ItemClick="ListView_ItemClick" ItemsSource="{x:Bind local:AddItem.AddItemsList}">
2222
<ListView.ItemTemplate>
2323
<DataTemplate>
24+
<Grid Height="50">
2425
<StackPanel>
2526
<TextBlock Text="{Binding Header}"/>
2627
<TextBlock Foreground="Gray" Text="{Binding SubHeader}"/>
2728
</StackPanel>
29+
</Grid>
2830
</DataTemplate>
2931
</ListView.ItemTemplate>
3032
</ListView>

AddItem.xaml.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ public AddItem()
2020
public static void AddItemsToList()
2121
{
2222
AddItemsList.Clear();
23-
AddItemsList.Add(new AddListItem { Header = "Folder", SubHeader = "Creates an empty folder.", isEnabled = true });
23+
AddItemsList.Add(new AddListItem { Header = "Folder", SubHeader = "Creates an empty folder", isEnabled = true });
2424
AddItemsList.Add(new AddListItem { Header = "Text Document", SubHeader = "Creates a simple file for text input", isEnabled = true });
25-
AddItemsList.Add(new AddListItem { Header = "Bitmap Image", SubHeader = "Creates an empty bitmap image file.", isEnabled = true });
26-
AddItemsList.Add(new AddListItem { Header = "Shortcut", SubHeader = "In Development: Creates a shortcut to a different location.", isEnabled = false });
27-
AddItemsList.Add(new AddListItem { Header = "Compressed Folder", SubHeader = "In Development: Creates a new compressed folder from an existing folder.", isEnabled = false });
25+
AddItemsList.Add(new AddListItem { Header = "Bitmap Image", SubHeader = "Creates an empty bitmap image file", isEnabled = true });
26+
2827
}
2928

3029

GenericFileBrowser.xaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,12 @@
191191

192192

193193
</Grid>
194-
195-
<ContentDialog PrimaryButtonText="Replace" SecondaryButtonText="Skip" Title="{x:Bind local2:ItemViewModel.ConflictBoxHeader.Header, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Name="ReviewBox" Grid.RowSpan="4">
194+
195+
<ContentDialog BorderThickness="0" Name="AddDialog" PrimaryButtonText="Cancel" Loaded="ContentDialog_Loaded" Grid.RowSpan="4">
196+
<Frame Width="450" Height="500" Name="AddDialogFrame"/>
197+
</ContentDialog>
198+
199+
<ContentDialog PrimaryButtonText="Replace" SecondaryButtonText="Skip" Title="{x:Bind local2:ItemViewModel.ConflictBoxHeader.Header, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Name="ReviewBox" Grid.RowSpan="4">
196200
<Grid>
197201
<TextBlock Name="ConflictSmallHeader" TextWrapping="WrapWholeWords" Text="{x:Bind local2:ItemViewModel.ConflictBoxSubHeader.SubHeader, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
198202
</Grid>

GenericFileBrowser.xaml.cs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using Windows.UI.ViewManagement;
1414
using Windows.UI.Xaml;
1515
using Windows.UI.Xaml.Controls;
16+
using Windows.UI.Xaml.Media.Animation;
1617
using Windows.UI.Xaml.Navigation;
1718

1819
namespace Files
@@ -73,20 +74,21 @@ public GenericFileBrowser()
7374

7475
private async void AddItem_ClickAsync(object sender, RoutedEventArgs e)
7576
{
76-
var CurrentView = ApplicationView.GetForCurrentView();
77-
CoreApplicationView NewView = CoreApplication.CreateNewView();
78-
79-
await NewView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
80-
{
81-
var newWindow = Window.Current;
82-
var newAppView = ApplicationView.GetForCurrentView();
83-
Frame frame = new Frame();
84-
frame.Navigate(typeof(AddItem), null);
85-
Window.Current.Content = frame;
86-
Window.Current.Activate();
87-
await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newAppView.Id, ViewSizePreference.Default, CurrentView.Id, ViewSizePreference.Default);
88-
89-
});
77+
await AddDialog.ShowAsync();
78+
//var CurrentView = ApplicationView.GetForCurrentView();
79+
//CoreApplicationView NewView = CoreApplication.CreateNewView();
80+
81+
//await NewView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
82+
//{
83+
// var newWindow = Window.Current;
84+
// var newAppView = ApplicationView.GetForCurrentView();
85+
// Frame frame = new Frame();
86+
// frame.Navigate(typeof(AddItem), null);
87+
// Window.Current.Content = frame;
88+
// Window.Current.Activate();
89+
// await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newAppView.Id, ViewSizePreference.Default, CurrentView.Id, ViewSizePreference.Default);
90+
91+
//});
9092
}
9193

9294
private void Clipboard_ContentChanged(object sender, object e)
@@ -208,7 +210,10 @@ private async void AllView_CellEditEnded(object sender, DataGridCellEditEndedEve
208210
}
209211
}
210212

211-
213+
private void ContentDialog_Loaded(object sender, RoutedEventArgs e)
214+
{
215+
AddDialogFrame.Navigate(typeof(AddItem), new SuppressNavigationTransitionInfo());
216+
}
212217
}
213218

214219
public class EmptyFolderTextState : INotifyPropertyChanged

0 commit comments

Comments
 (0)