Skip to content
This repository was archived by the owner on Jan 8, 2022. It is now read-only.

Commit b9cc20f

Browse files
committed
GUI changes
1 parent c8f56e0 commit b9cc20f

File tree

7 files changed

+142
-32
lines changed

7 files changed

+142
-32
lines changed
434 Bytes
Loading

Source/Deployer.Raspberry.Gui/Deployer.Raspberry.Gui.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@
116116
<SubType>Designer</SubType>
117117
<Generator>MSBuild:Compile</Generator>
118118
</Page>
119+
<Page Include="Views\Parts\DiskSelectionPart.xaml">
120+
<Generator>MSBuild:Compile</Generator>
121+
<SubType>Designer</SubType>
122+
</Page>
119123
<Page Include="Views\Parts\DualBootPart.xaml">
120124
<SubType>Designer</SubType>
121125
<Generator>MSBuild:Compile</Generator>
@@ -143,6 +147,9 @@
143147
<Compile Include="Views\Parts\DeploymentPart.xaml.cs">
144148
<DependentUpon>DeploymentPart.xaml</DependentUpon>
145149
</Compile>
150+
<Compile Include="Views\Parts\DiskSelectionPart.xaml.cs">
151+
<DependentUpon>DiskSelectionPart.xaml</DependentUpon>
152+
</Compile>
146153
<Compile Include="Views\Parts\DualBootPart.xaml.cs">
147154
<DependentUpon>DualBootPart.xaml</DependentUpon>
148155
</Compile>
@@ -284,5 +291,8 @@
284291
<ItemGroup>
285292
<Resource Include="Assets\heart.png" />
286293
</ItemGroup>
294+
<ItemGroup>
295+
<Resource Include="Assets\drive.png" />
296+
</ItemGroup>
287297
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
288298
</Project>

Source/Deployer.Raspberry.Gui/ViewModels/DeploymentViewModel.cs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
24
using System.Reactive;
35
using System.Reactive.Linq;
46
using System.Threading.Tasks;
7+
using Deployer.FileSystem;
58
using Deployer.Gui.Core;
69
using ReactiveUI;
710

@@ -14,12 +17,14 @@ public class DeploymentViewModel : ReactiveObject, IBusy
1417
private readonly UIServices uiServices;
1518
private readonly AdvancedViewModel advancedViewModel;
1619
private readonly WimPickViewModel wimPickViewModel;
17-
private readonly ObservableAsPropertyHelper<bool> isBusyHelper;
20+
private readonly ObservableAsPropertyHelper<bool> isBusy;
21+
private DiskViewModel selectedDisk;
22+
private readonly ObservableAsPropertyHelper<IEnumerable<DiskViewModel>> disks;
1823

1924
public DeploymentViewModel(
2025
IWindowsOptionsProvider optionsProvider,
2126
IWoaDeployer deployer, UIServices uiServices, AdvancedViewModel advancedViewModel,
22-
WimPickViewModel wimPickViewModel)
27+
WimPickViewModel wimPickViewModel, ILowLevelApi lowLevel)
2328
{
2429
this.optionsProvider = optionsProvider;
2530
this.deployer = deployer;
@@ -33,10 +38,28 @@ public DeploymentViewModel(
3338
FullInstallWrapper = new CommandWrapper<Unit, Unit>(this,
3439
ReactiveCommand.CreateFromTask(Deploy, isSelectedWim), uiServices.DialogService);
3540
IsBusyObservable = FullInstallWrapper.Command.IsExecuting;
36-
isBusyHelper = IsBusyObservable.ToProperty(this, model => model.IsBusy);
41+
isBusy = IsBusyObservable.ToProperty(this, model => model.IsBusy);
42+
43+
RefreshDisksCommandWrapper = new CommandWrapper<Unit, ICollection<Disk>>(this,
44+
ReactiveCommand.CreateFromTask(lowLevel.GetDisks), uiServices.DialogService);
45+
disks = RefreshDisksCommandWrapper.Command
46+
.Select(x => x
47+
.Where(y => !y.IsBoot && !y.IsSystem && !y.IsOffline)
48+
.Select(disk => new DiskViewModel(disk)))
49+
.ToProperty(this, x => x.Disks);
50+
}
51+
52+
public IEnumerable<DiskViewModel> Disks => disks.Value;
53+
54+
public CommandWrapper<Unit, ICollection<Disk>> RefreshDisksCommandWrapper { get; set; }
55+
56+
public DiskViewModel SelectedDisk
57+
{
58+
get => selectedDisk;
59+
set => this.RaiseAndSetIfChanged(ref selectedDisk, value);
3760
}
3861

39-
public bool IsBusy => isBusyHelper.Value;
62+
public bool IsBusy => isBusy.Value;
4063

4164
private async Task Deploy()
4265
{

Source/Deployer.Raspberry.Gui/Views/Parts/AdvancedPart.xaml

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,12 @@
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:common="clr-namespace:Deployer.Gui.Common;assembly=Deployer.Gui.Common"
76
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
8-
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
97
mc:Ignorable="d"
108
d:DesignHeight="450" d:DesignWidth="800" Padding="8"
119
DataContext="{Binding Source={StaticResource Locator}, Path=AdvancedViewModel}" mah:DialogParticipation.Register="{Binding}">
1210
<StackPanel>
13-
<GroupBox Header="GPU" Padding="20" Margin="0,20,0,0">
14-
<HeaderedContentControl
15-
HorizontalContentAlignment="Stretch">
16-
<HeaderedContentControl.Header>
17-
<TextBlock>
18-
EXPERIMENTAL: This will install the GPU drivers. Use it with caution.
19-
<LineBreak />
20-
<Bold>ONLY for Lumia 950 XL.</Bold>
21-
</TextBlock>
22-
</HeaderedContentControl.Header>
23-
<common:IconButton Margin="20"
24-
VerticalAlignment="Center" HorizontalAlignment="Center" Height="50"
25-
Content="Install GPU" Command="{Binding InstallGpuWrapper.Command}"
26-
IsBusy="{Binding InstallGpuWrapper.IsExecuting}">
27-
<common:IconButton.Icon>
28-
<iconPacks:PackIconMaterial Kind="Chip" Style="{StaticResource ButtonIconStyle}" />
29-
</common:IconButton.Icon>
30-
</common:IconButton>
31-
</HeaderedContentControl>
32-
33-
</GroupBox>
34-
11+
3512
<GroupBox Header="Misc" Padding="20" Margin="0,20,0,0">
3613
<UniformGrid Rows="1">
3714
<HeaderedContentControl

Source/Deployer.Raspberry.Gui/Views/Parts/DeploymentPart.xaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,20 @@
77
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
88
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
99
xmlns:parts="clr-namespace:Deployer.Raspberry.Gui.Views.Parts"
10+
xmlns:Interactions="http://schemas.microsoft.com/xaml/behaviors"
1011
mc:Ignorable="d"
1112
d:DesignHeight="450" d:DesignWidth="800"
1213
DataContext="{Binding Source={StaticResource Locator}, Path=DeploymentViewModel}" mah:DialogParticipation.Register="{Binding}">
14+
15+
<Interactions:Interaction.Triggers>
16+
<Interactions:EventTrigger EventName="Loaded">
17+
<Interactions:EventTrigger.Actions>
18+
<!--<Interactions:InvokeCommandAction Command="{Binding ShowWarningCommand}" />-->
19+
<Interactions:InvokeCommandAction Command="{Binding RefreshDisksCommandWrapper.Command}" />
20+
</Interactions:EventTrigger.Actions>
21+
</Interactions:EventTrigger>
22+
</Interactions:Interaction.Triggers>
23+
1324
<Grid>
1425

1526
<Grid.RowDefinitions>
@@ -27,22 +38,25 @@
2738
<RowDefinition/>
2839
</Grid.RowDefinitions>
2940

30-
<parts:WimOptionsPart Margin="8,10,0,10" />
41+
<UniformGrid Rows="1">
42+
<parts:DiskSelectionPart Margin="8,0" />
43+
<parts:WimOptionsPart Margin="8,0" />
44+
</UniformGrid>
3145

3246
<common:IconButton Grid.Row="1" VerticalAlignment="Center" Command="{Binding FullInstallWrapper.Command}"
3347
IsBusy="{Binding FullInstallWrapper.IsExecuting}" Content="Deploy"
3448
Height="50"
3549
HorizontalAlignment="Center"
3650
ToolTip="Use this option to install Windows into a Phone that has just been unlocked.">
3751
<common:IconButton.Resources>
38-
52+
3953
</common:IconButton.Resources>
4054
<common:IconButton.Icon>
4155
<iconPacks:PackIconFontAwesome
42-
Kind="RocketSolid" Style="{StaticResource ButtonIconStyle}" />
56+
Kind="RocketSolid" Style="{StaticResource ButtonIconStyle}" />
4357
</common:IconButton.Icon>
4458
</common:IconButton>
45-
59+
4660
</Grid>
4761
</Grid>
4862
</UserControl>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<UserControl x:Class="Deployer.Raspberry.Gui.Views.Parts.DiskSelectionPart"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
7+
xmlns:viewModels1="clr-namespace:Deployer.Raspberry.Gui.ViewModels"
8+
mc:Ignorable="d"
9+
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance viewModels1:DeploymentViewModel}"
10+
x:Name="UserControl">
11+
<GroupBox Header="Drive selection" Padding="8">
12+
<GroupBox.Resources>
13+
<CollectionViewSource x:Key="Disks" Source="{Binding Disks}">
14+
<CollectionViewSource.SortDescriptions>
15+
<componentModel:SortDescription PropertyName="Number" />
16+
</CollectionViewSource.SortDescriptions>
17+
</CollectionViewSource>
18+
</GroupBox.Resources>
19+
<StackPanel VerticalAlignment="Center">
20+
21+
<TextBlock TextWrapping="Wrap" Margin="0,8">
22+
Please, select the <Bold>drive</Bold> where you want to deploy Windows 10 ARM64. This is, the <Bold>Micro SD</Bold> card from your Raspberry Pi.
23+
</TextBlock>
24+
25+
<Grid>
26+
<Grid.ColumnDefinitions>
27+
<ColumnDefinition/>
28+
<ColumnDefinition Width="Auto"/>
29+
</Grid.ColumnDefinitions>
30+
<ComboBox Grid.RowSpan="2" ItemsSource="{Binding Source={StaticResource Disks}}"
31+
HorizontalContentAlignment="Stretch"
32+
SelectedItem="{Binding SelectedDisk, Mode=TwoWay}"
33+
IsEnabled="{Binding RefreshDisksCommandWrapper.IsExecuting, Converter={StaticResource BooleanToVisibilityConverterInverted}}">
34+
<ComboBox.ItemTemplate>
35+
<DataTemplate>
36+
<Grid x:Name="Container" Height="30" Visibility="{Binding ElementName=UserControl, Path=DataContext.RefreshDisksCommandWrapper.IsExecuting, Converter={StaticResource BooleanToVisibilityConverterInverted}}" >
37+
<Grid.ColumnDefinitions>
38+
<ColumnDefinition Width="Auto"/>
39+
<ColumnDefinition/>
40+
</Grid.ColumnDefinitions>
41+
<Image Source="/Assets/drive.png" />
42+
<TextBlock Margin="10, 0" x:Name="TextBlock" Grid.Column="1" VerticalAlignment="Center">
43+
<TextBlock.Text>
44+
<MultiBinding StringFormat="{}{0}: {1} - {2}">
45+
<Binding Path="Number" />
46+
<Binding Path="FriendlyName" />
47+
<Binding Path="Size" />
48+
</MultiBinding>
49+
</TextBlock.Text>
50+
</TextBlock>
51+
</Grid>
52+
<DataTemplate.Triggers>
53+
<DataTrigger Binding="{Binding IsUsualTarget}" Value="False">
54+
<Setter TargetName="TextBlock" Property="Foreground" Value="Red"/>
55+
</DataTrigger>
56+
</DataTemplate.Triggers>
57+
</DataTemplate>
58+
</ComboBox.ItemTemplate>
59+
</ComboBox>
60+
<Grid Grid.Column="0"
61+
Visibility="{Binding RefreshDisksCommandWrapper.IsExecuting, Converter={StaticResource BooleanToVisibilityConverter}}" >
62+
<Grid.RowDefinitions>
63+
<RowDefinition />
64+
<RowDefinition Height="5"/>
65+
</Grid.RowDefinitions>
66+
<TextBlock VerticalAlignment="Center" TextAlignment="Center" Grid.Row="0" Text="Loading..."/>
67+
<ProgressBar Grid.Row="1" IsIndeterminate="True"/>
68+
</Grid>
69+
<Button Margin="10,0" VerticalAlignment="Center" Grid.Column="1" Content="Refresh" Command="{Binding RefreshDisksCommandWrapper.Command}" />
70+
</Grid>
71+
72+
</StackPanel>
73+
</GroupBox>
74+
</UserControl>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Windows.Controls;
2+
3+
namespace Deployer.Raspberry.Gui.Views.Parts
4+
{
5+
public partial class DiskSelectionPart
6+
{
7+
public DiskSelectionPart()
8+
{
9+
InitializeComponent();
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)