finish update button controls
This commit is contained in:
parent
992931b15c
commit
94b7d04908
@ -10,17 +10,37 @@
|
||||
|
||||
<Panel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" IsVisible="False" IsEnabled="False">
|
||||
<Button Content="Update Installer to v2.56" CornerRadius="20 0 0 20" Classes="yellow"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="!Updating" RelativeSource="{RelativeSource AncestorType=UserControl}"/>
|
||||
<Binding Path="UpdateAvailable" RelativeSource="{RelativeSource AncestorType=UserControl}"/>
|
||||
</MultiBinding>
|
||||
</StackPanel.IsVisible>
|
||||
<Button Content="{Binding InfoText, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CornerRadius="20 0 0 20"
|
||||
Classes="yellow"
|
||||
Command="{Binding UpdateCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
/>
|
||||
|
||||
<Button Content="Not now" CornerRadius="0 20 20 0" />
|
||||
<Button Content="Not now" CornerRadius="0 20 20 0"
|
||||
Command="{Binding DismissCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
/>
|
||||
</StackPanel>
|
||||
|
||||
<Panel IsVisible="True" IsEnabled="True">
|
||||
<Panel Margin="0 10">
|
||||
<Panel.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.Or}">
|
||||
<Binding Path="Updating" RelativeSource="{RelativeSource AncestorType=UserControl}"/>
|
||||
<Binding Path="CheckingForUpdate" RelativeSource="{RelativeSource AncestorType=UserControl}"/>
|
||||
</MultiBinding>
|
||||
</Panel.IsVisible>
|
||||
<ProgressBar CornerRadius="20" VerticalAlignment="Stretch"
|
||||
Value="10" IsIndeterminate="True"
|
||||
Value="{Binding DownloadProgress, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
IsIndeterminate="{Binding IsIndeterminate, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
/>
|
||||
<Label Content="Downloading v2.56" VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
<Label Content="{Binding InfoText, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
Foreground="Black" FontWeight="SemiBold"/>
|
||||
</Panel>
|
||||
</Panel>
|
||||
|
@ -20,13 +20,13 @@ public partial class UpdateButton : UserControl
|
||||
set => SetValue(InfoTextProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> ShowProperty = AvaloniaProperty.Register<UpdateButton, bool>(
|
||||
"Show");
|
||||
public static readonly StyledProperty<bool> CheckingForUpdateProperty = AvaloniaProperty.Register<UpdateButton, bool>(
|
||||
"CheckingForUpdate");
|
||||
|
||||
public bool Show
|
||||
public bool CheckingForUpdate
|
||||
{
|
||||
get => GetValue(ShowProperty);
|
||||
set => SetValue(ShowProperty, value);
|
||||
get => GetValue(CheckingForUpdateProperty);
|
||||
set => SetValue(CheckingForUpdateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<ICommand> DismissCommandProperty = AvaloniaProperty.Register<UpdateButton, ICommand>(
|
||||
|
@ -20,11 +20,11 @@ public class InstallerUpdateInfo : ReactiveObject
|
||||
set => this.RaiseAndSetIfChanged(ref _updateInfoText, value);
|
||||
}
|
||||
|
||||
private bool _showCard = false;
|
||||
public bool ShowCard
|
||||
private bool _show = false;
|
||||
public bool Show
|
||||
{
|
||||
get => _showCard;
|
||||
set => this.RaiseAndSetIfChanged(ref _showCard, value);
|
||||
get => _show;
|
||||
set => this.RaiseAndSetIfChanged(ref _show, value);
|
||||
}
|
||||
|
||||
private bool _updating = false;
|
||||
@ -89,7 +89,7 @@ public class InstallerUpdateInfo : ReactiveObject
|
||||
|
||||
private async Task<string> DownloadNewInstaller()
|
||||
{
|
||||
UpdateInfoText = $"Downloading new installer v{_newVersion}";
|
||||
UpdateInfoText = $"Downloading installer v{_newVersion}";
|
||||
|
||||
var progress = new Progress<double>(x => DownloadProgress = (int)x);
|
||||
|
||||
@ -112,21 +112,7 @@ public class InstallerUpdateInfo : ReactiveObject
|
||||
}
|
||||
|
||||
UpdateInfoText = infoText;
|
||||
|
||||
if (!updateAvailable)
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
// delay card dismiss
|
||||
await Task.Delay(TimeSpan.FromSeconds(2));
|
||||
ShowCard = updateAvailable;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowCard = updateAvailable;
|
||||
}
|
||||
|
||||
Show = updateAvailable;
|
||||
CheckingForUpdates = false;
|
||||
UpdateAvailable = updateAvailable;
|
||||
}
|
||||
@ -137,7 +123,7 @@ public class InstallerUpdateInfo : ReactiveObject
|
||||
return;
|
||||
|
||||
UpdateInfoText = "Checking for installer updates";
|
||||
ShowCard = true;
|
||||
Show = true;
|
||||
CheckingForUpdates = true;
|
||||
|
||||
try
|
||||
@ -172,7 +158,7 @@ public class InstallerUpdateInfo : ReactiveObject
|
||||
|
||||
NewInstallerUrl = latest.Assets[0].BrowserDownloadUrl;
|
||||
|
||||
EndCheck($"Update available, version {latestVersion}", true);
|
||||
EndCheck($"Update available: v{latestVersion}", true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ public class PreChecksViewModel : ViewModelBase
|
||||
|
||||
StartInstallCommand = ReactiveCommand.Create(async () =>
|
||||
{
|
||||
UpdateInfo.ShowCard = false;
|
||||
UpdateInfo.Show = false;
|
||||
NavigateTo(new InstallViewModel(HostScreen));
|
||||
});
|
||||
|
||||
@ -233,7 +233,7 @@ public class PreChecksViewModel : ViewModelBase
|
||||
|
||||
DismissUpdateCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
UpdateInfo.ShowCard = false;
|
||||
UpdateInfo.Show = false;
|
||||
});
|
||||
|
||||
|
||||
|
@ -75,10 +75,10 @@
|
||||
|
||||
<!-- Start install button -->
|
||||
<Button Grid.Column="2" Grid.Row="3" Padding="20 10"
|
||||
IsVisible="False"
|
||||
IsVisible="{Binding !UpdateInfo.Show}"
|
||||
IsEnabled="{Binding AllowInstall}"
|
||||
FontSize="15" FontWeight="SemiBold"
|
||||
Classes="yellow"
|
||||
IsEnabled="{Binding AllowInstall}"
|
||||
Command="{Binding StartInstallCommand}"
|
||||
CornerRadius="15"
|
||||
>
|
||||
@ -89,18 +89,17 @@
|
||||
</Button>
|
||||
|
||||
<!-- Update installer button -->
|
||||
<cc:UpdateButton Grid.Column="2" Grid.Row="3" Padding="20 10"/>
|
||||
|
||||
<!-- <cc:UpdateInfoCard Grid.Row="1" Grid.RowSpan="5" Grid.ColumnSpan="5" Padding="10" -->
|
||||
<!-- VerticalAlignment="Center" HorizontalAlignment="Center" -->
|
||||
<!-- InfoText="{Binding UpdateInfo.UpdateInfoText}" -->
|
||||
<!-- ShowUpdateCard="{Binding UpdateInfo.ShowCard}" -->
|
||||
<!-- NotNowCommand="{Binding DismissUpdateCommand}" -->
|
||||
<!-- UpdateInstallerCommand="{Binding UpdateInstallerCommand}" -->
|
||||
<!-- Updating="{Binding UpdateInfo.Updating}" -->
|
||||
<!-- DownloadProgress="{Binding UpdateInfo.DownloadProgress}" -->
|
||||
<!-- IndeterminateProgress="{Binding UpdateInfo.CheckingForUpdates}" -->
|
||||
<!-- UpdateAvailable="{Binding UpdateInfo.UpdateAvailable}" -->
|
||||
<!-- /> -->
|
||||
<cc:UpdateButton Grid.Column="2" Grid.Row="3"
|
||||
IsVisible="{Binding UpdateInfo.Show}"
|
||||
IsEnabled="{Binding UpdateInfo.Show}"
|
||||
IsIndeterminate="{Binding UpdateInfo.CheckingForUpdates}"
|
||||
InfoText="{Binding UpdateInfo.UpdateInfoText}"
|
||||
Updating="{Binding UpdateInfo.Updating}"
|
||||
DismissCommand="{Binding DismissUpdateCommand}"
|
||||
UpdateCommand="{Binding UpdateInstallerCommand}"
|
||||
DownloadProgress="{Binding UpdateInfo.DownloadProgress}"
|
||||
UpdateAvailable="{Binding UpdateInfo.UpdateAvailable}"
|
||||
CheckingForUpdate="{Binding UpdateInfo.CheckingForUpdates}"
|
||||
/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
Loading…
x
Reference in New Issue
Block a user