From 384010ca0a142123551407cac3231ed8fb429afe Mon Sep 17 00:00:00 2001 From: Ruben Date: Tue, 29 Oct 2024 20:47:20 +0100 Subject: [PATCH] Show loading indicator when clicking update button in about dialog --- src/PicView.Avalonia/Views/AboutView.axaml | 247 +++++++++--------- src/PicView.Avalonia/Views/AboutView.axaml.cs | 15 +- 2 files changed, 140 insertions(+), 122 deletions(-) diff --git a/src/PicView.Avalonia/Views/AboutView.axaml b/src/PicView.Avalonia/Views/AboutView.axaml index 8a56d4df..ac9aa37f 100644 --- a/src/PicView.Avalonia/Views/AboutView.axaml +++ b/src/PicView.Avalonia/Views/AboutView.axaml @@ -5,6 +5,7 @@ xmlns="https://github.com/avaloniaui" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:uc="clr-namespace:PicView.Avalonia.Views.UC" xmlns:viewModels="clr-namespace:PicView.Avalonia.ViewModels" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> @@ -111,149 +112,153 @@ - + + - + - - + + + + + + + + + + - - - + Text="PicView.org" /> + - - + HorizontalAlignment="Center" + Margin="0,7,0,7" + Text="2017 - 2024 © Ruben Hyldgaard Negendahl" /> - + + + - - + HorizontalAlignment="Center" + Margin="0,25,0,10"> + + + - - - - + - + + + - - - - - - - - + HorizontalAlignment="Center" + Margin="0,5,0,5" + Text="{CompiledBinding Credits}" /> - - - + + + - - - + + + - - - + + + - - - - + + + + + + + + + \ No newline at end of file diff --git a/src/PicView.Avalonia/Views/AboutView.axaml.cs b/src/PicView.Avalonia/Views/AboutView.axaml.cs index aee095bf..ada6e413 100644 --- a/src/PicView.Avalonia/Views/AboutView.axaml.cs +++ b/src/PicView.Avalonia/Views/AboutView.axaml.cs @@ -44,7 +44,20 @@ public AboutView() // TODO: replace with auto update service UpdateButton.Click += async (_, _) => { - await UpdateManager.UpdateCurrentVersion(DataContext as MainViewModel); + //Set loading and prevent user from interacting with UI + ParentContainer.Opacity = .1; + ParentContainer.IsHitTestVisible = false; + SpinWaiter.IsVisible = true; + try + { + await UpdateManager.UpdateCurrentVersion(DataContext as MainViewModel); + } + finally + { + SpinWaiter.IsVisible = false; + ParentContainer.IsHitTestVisible = true; + ParentContainer.Opacity = 1; + } }; }; }