diff --git a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml
index 3b27108..bfc4e19 100644
--- a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml
+++ b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml
@@ -1,118 +1,180 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml.cs b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml.cs
index 5fa78e3..68de8d7 100644
--- a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml.cs
+++ b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml.cs
@@ -1,4 +1,18 @@
using Bloxstrap.UI.ViewModels.Menu;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
namespace Bloxstrap.UI.Elements.Menu.Pages
{
@@ -12,5 +26,10 @@ namespace Bloxstrap.UI.Elements.Menu.Pages
DataContext = new BehaviourViewModel();
InitializeComponent();
}
+
+ private void ToggleSwitch_Checked(object sender, RoutedEventArgs e)
+ {
+
+ }
}
}
diff --git a/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs
index 71603bc..ef4c5bb 100644
--- a/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs
+++ b/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs
@@ -1,12 +1,10 @@
-using System.Windows;
-
-using Bloxstrap.Exceptions;
+using Bloxstrap.Exceptions;
namespace Bloxstrap.UI.ViewModels.Menu
{
public class BehaviourViewModel : NotifyPropertyChangedViewModel
{
- private bool _manualChannelEntry = !RobloxDeployment.SelectableChannels.Contains(App.Settings.Prop.Channel);
+ private string _oldVersionGuid = "";
public BehaviourViewModel()
{
@@ -16,22 +14,22 @@ namespace Bloxstrap.UI.ViewModels.Menu
private async Task LoadChannelDeployInfo(string channel)
{
const string LOG_IDENT = "BehaviourViewModel::LoadChannelDeployInfo";
-
- LoadingSpinnerVisibility = Visibility.Visible;
- LoadingErrorVisibility = Visibility.Collapsed;
- ChannelInfoLoadingText = "Fetching latest deploy info, please wait...";
- ChannelDeployInfo = null;
- OnPropertyChanged(nameof(LoadingSpinnerVisibility));
- OnPropertyChanged(nameof(LoadingErrorVisibility));
+ ShowLoadingError = false;
+ OnPropertyChanged(nameof(ShowLoadingError));
+
+ ChannelInfoLoadingText = "Fetching latest deploy info, please wait...";
OnPropertyChanged(nameof(ChannelInfoLoadingText));
+
+ ChannelDeployInfo = null;
OnPropertyChanged(nameof(ChannelDeployInfo));
try
{
ClientVersion info = await RobloxDeployment.GetInfo(channel, true);
- ChannelWarningVisibility = info.IsBehindDefaultChannel ? Visibility.Visible : Visibility.Collapsed;
+ ShowChannelWarning = info.IsBehindDefaultChannel;
+ OnPropertyChanged(nameof(ShowChannelWarning));
ChannelDeployInfo = new DeployInfo
{
@@ -40,43 +38,35 @@ namespace Bloxstrap.UI.ViewModels.Menu
Timestamp = info.Timestamp?.ToFriendlyString()!
};
- OnPropertyChanged(nameof(ChannelWarningVisibility));
OnPropertyChanged(nameof(ChannelDeployInfo));
}
catch (HttpResponseUnsuccessfulException ex)
{
- LoadingSpinnerVisibility = Visibility.Collapsed;
- LoadingErrorVisibility = Visibility.Visible;
+ ShowLoadingError = true;
+ OnPropertyChanged(nameof(ShowLoadingError));
ChannelInfoLoadingText = ex.ResponseMessage.StatusCode switch
{
HttpStatusCode.NotFound => "The specified channel name does not exist.",
_ => $"Failed to fetch information! (HTTP {ex.ResponseMessage.StatusCode})",
};
-
- OnPropertyChanged(nameof(LoadingSpinnerVisibility));
- OnPropertyChanged(nameof(LoadingErrorVisibility));
OnPropertyChanged(nameof(ChannelInfoLoadingText));
}
catch (Exception ex)
{
- LoadingSpinnerVisibility = Visibility.Collapsed;
- LoadingErrorVisibility = Visibility.Visible;
-
App.Logger.WriteLine(LOG_IDENT, "An exception occurred while fetching channel information");
App.Logger.WriteException(LOG_IDENT, ex);
+ ShowLoadingError = true;
+ OnPropertyChanged(nameof(ShowLoadingError));
+
ChannelInfoLoadingText = $"Failed to fetch information! ({ex.Message})";
-
- OnPropertyChanged(nameof(LoadingSpinnerVisibility));
- OnPropertyChanged(nameof(LoadingErrorVisibility));
OnPropertyChanged(nameof(ChannelInfoLoadingText));
}
}
- 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 bool ShowLoadingError { get; set; } = false;
+ public bool ShowChannelWarning { get; set; } = false;
public DeployInfo? ChannelDeployInfo { get; private set; } = null;
public string ChannelInfoLoadingText { get; private set; } = null!;
@@ -110,24 +100,6 @@ namespace Bloxstrap.UI.ViewModels.Menu
}
}
- public bool ManualChannelEntry
- {
- get => _manualChannelEntry;
- set
- {
- _manualChannelEntry = value;
-
- if (!value)
- {
- // roblox typically sets channels in all lowercase, so here we find if a case insensitive match exists
- string? matchingChannel = Channels.Where(x => x.ToLowerInvariant() == SelectedChannel.ToLowerInvariant()).FirstOrDefault();
- SelectedChannel = string.IsNullOrEmpty(matchingChannel) ? RobloxDeployment.DefaultChannel : matchingChannel;
- }
-
- OnPropertyChanged(nameof(SelectedChannel));
- }
- }
-
// todo - move to enum attributes?
public IReadOnlyDictionary ChannelChangeModes => new Dictionary
{
@@ -141,5 +113,22 @@ namespace Bloxstrap.UI.ViewModels.Menu
get => ChannelChangeModes.FirstOrDefault(x => x.Value == App.Settings.Prop.ChannelChangeMode).Key;
set => App.Settings.Prop.ChannelChangeMode = ChannelChangeModes[value];
}
+
+ public bool ForceRobloxReinstallation
+ {
+ get => String.IsNullOrEmpty(App.State.Prop.VersionGuid);
+ set
+ {
+ if (value)
+ {
+ _oldVersionGuid = App.State.Prop.VersionGuid;
+ App.State.Prop.VersionGuid = "";
+ }
+ else
+ {
+ App.State.Prop.VersionGuid = _oldVersionGuid;
+ }
+ }
+ }
}
}