Skip to content

Commit 6cf731c

Browse files
committed
Add UI for files
1 parent 5218382 commit 6cf731c

File tree

2 files changed

+61
-9
lines changed

2 files changed

+61
-9
lines changed

LiveWriterPluginManager/Controls/CreatePackageControl.xaml

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,72 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:viewModel="clr-namespace:LiveWriterPluginManager.ViewModel"
67
mc:Ignorable="d"
78
d:DesignHeight="300"
89
d:DesignWidth="300"
910
DataContext="{Binding CreatePackage, Source={StaticResource Locator}}">
11+
12+
<UserControl.Resources>
13+
<DataTemplate DataType="{x:Type viewModel:FileViewModel}">
14+
<Border BorderBrush="{StaticResource LiveWriterPurpleBrush}"
15+
BorderThickness="0,0,0,1"
16+
Padding="10">
17+
<Grid>
18+
<Grid.ColumnDefinitions>
19+
<ColumnDefinition Width="*" />
20+
<ColumnDefinition Width="Auto" />
21+
</Grid.ColumnDefinitions>
22+
23+
<TextBlock Text="{Binding Name}"
24+
VerticalAlignment="Center"/>
25+
26+
<Button Grid.Column="1"
27+
Style="{StaticResource MaterialDesignFloatingActionMiniAccentButton}"
28+
Height="30"
29+
Width="30"
30+
Command="{Binding RemoveFileCommand}">
31+
<Viewbox Stretch="Uniform"
32+
StretchDirection="DownOnly"
33+
Width="20"
34+
Height="20"
35+
HorizontalAlignment="Center"
36+
VerticalAlignment="Center">
37+
<Path Height="15"
38+
Width="10"
39+
Stretch="Fill"
40+
Fill="White"
41+
Data="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z" />
42+
</Viewbox>
43+
</Button>
44+
</Grid>
45+
</Border>
46+
</DataTemplate>
47+
</UserControl.Resources>
1048
<Grid>
1149
<Grid.RowDefinitions>
12-
<RowDefinition Height="Auto"/>
13-
<RowDefinition Height="*"/>
50+
<RowDefinition Height="Auto" />
51+
<RowDefinition Height="*" />
52+
<RowDefinition Height="Auto" />
1453
</Grid.RowDefinitions>
54+
55+
<StackPanel>
56+
<TextBlock Text="Please choose the files that you would like to add to your package."
57+
TextWrapping="WrapWithOverflow"
58+
Margin="10" />
59+
<Button Content="Add files"
60+
HorizontalAlignment="Left"
61+
Margin="10,0,10,10"
62+
Command="{Binding AddFilesCommand}" />
63+
</StackPanel>
64+
65+
<ListView ItemsSource="{Binding Files}"
66+
Grid.Row="1" />
67+
68+
<Button Content="Create package"
69+
Grid.Row="2"
70+
HorizontalAlignment="Right"
71+
Margin="10"
72+
IsEnabled="{Binding IsValidPackage}" />
1573
</Grid>
1674
</UserControl>

LiveWriterPluginManager/ViewModel/CreatePackageViewModel.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,7 @@ public RelayCommand AddFilesCommand
4141
{
4242
var filenames = _fileService.GetPackageFiles();
4343
var files = filenames.Select(x => new FileViewModel(x)).ToList();
44-
if (!files.Any(x => x.Name.Equals(Manifest.ManifestFileName, StringComparison.InvariantCultureIgnoreCase)))
45-
{
46-
IsValidPackage = false;
47-
return;
48-
}
49-
50-
IsValidPackage = true;
44+
IsValidPackage = files.Any(x => x.Name.Equals(Manifest.ManifestFileName, StringComparison.InvariantCultureIgnoreCase));
5145

5246
foreach (var file in files)
5347
{

0 commit comments

Comments
 (0)