From e683af373d2407bf8ddc4255132c4a7bf2edae22 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Thu, 13 Jul 2023 13:29:27 +0100 Subject: [PATCH] Channel selector - warning if out of date --- Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml | 7 +++++++ Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml index 0c193c2..9f28d66 100644 --- a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml +++ b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml @@ -61,6 +61,7 @@ + @@ -75,6 +76,11 @@ + + + + + @@ -93,6 +99,7 @@ + diff --git a/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs index 6c19562..331c997 100644 --- a/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs @@ -40,6 +40,11 @@ namespace Bloxstrap.UI.ViewModels.Menu { ClientVersion info = await RobloxDeployment.GetInfo(channel, true); + if (info.Timestamp?.AddMonths(1) < DateTime.Now) + ChannelWarningVisibility = Visibility.Visible; + else + ChannelWarningVisibility = Visibility.Collapsed; + ChannelDeployInfo = new DeployInfo { Version = info.Version, @@ -47,13 +52,14 @@ namespace Bloxstrap.UI.ViewModels.Menu Timestamp = info.Timestamp?.ToFriendlyString()! }; + OnPropertyChanged(nameof(ChannelWarningVisibility)); OnPropertyChanged(nameof(ChannelDeployInfo)); } catch (Exception) { LoadingSpinnerVisibility = Visibility.Collapsed; LoadingErrorVisibility = Visibility.Visible; - ChannelInfoLoadingText = "Could not get deployment information. Is the channel name valid?"; + ChannelInfoLoadingText = "Could not get deployment information! Is the channel name valid?"; OnPropertyChanged(nameof(LoadingSpinnerVisibility)); OnPropertyChanged(nameof(LoadingErrorVisibility)); @@ -63,6 +69,7 @@ namespace Bloxstrap.UI.ViewModels.Menu public Visibility LoadingSpinnerVisibility { get; private set; } = Visibility.Visible; public Visibility LoadingErrorVisibility { get; private set; } = Visibility.Collapsed; + public Visibility ChannelWarningVisibility { get; private set; } = Visibility.Collapsed; public DeployInfo? ChannelDeployInfo { get; private set; } = null; public string ChannelInfoLoadingText { get; private set; } = null!;