diff --git a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml
index 7be1e43..61d4049 100644
--- a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml
+++ b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml
@@ -9,9 +9,9 @@
Title="BehaviourPage"
Scrollable="True">
-
+
-
+
@@ -20,6 +20,7 @@
+
@@ -29,5 +30,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml.cs b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml.cs
index f423e1b..a1627f7 100644
--- a/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml.cs
+++ b/Bloxstrap/UI/Elements/Menu/Pages/BehaviourPage.xaml.cs
@@ -1,4 +1,9 @@
-using Bloxstrap.UI.ViewModels.Menu;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Input;
+
+using Bloxstrap.UI.ViewModels.Menu;
namespace Bloxstrap.UI.Menu.Pages
{
@@ -12,5 +17,21 @@ namespace Bloxstrap.UI.Menu.Pages
DataContext = new BehaviourViewModel();
InitializeComponent();
}
+
+ // https://stackoverflow.com/a/13289118/11852173
+ // yes this doesnt fully conform to xaml but whatever
+ private void TextBox_KeyEnterUpdate(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter)
+ {
+ TextBox tBox = (TextBox)sender;
+ DependencyProperty prop = TextBox.TextProperty;
+
+ BindingExpression binding = BindingOperations.GetBindingExpression(tBox, prop);
+
+ if (binding is not null)
+ binding.UpdateSource();
+ }
+ }
}
}
diff --git a/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml b/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml
index 510f8a8..b478e7b 100644
--- a/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml
+++ b/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml
@@ -10,7 +10,7 @@
Title="InstallationPage"
Scrollable="True">
-
+
@@ -46,89 +46,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml.cs b/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml.cs
index 7bf5b8b..1a21b6d 100644
--- a/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml.cs
+++ b/Bloxstrap/UI/Elements/Menu/Pages/InstallationPage.xaml.cs
@@ -1,9 +1,4 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Input;
-
-using Bloxstrap.UI.ViewModels.Menu;
+using Bloxstrap.UI.ViewModels.Menu;
namespace Bloxstrap.UI.Menu.Pages
{
@@ -17,21 +12,5 @@ namespace Bloxstrap.UI.Menu.Pages
DataContext = new InstallationViewModel();
InitializeComponent();
}
-
- // https://stackoverflow.com/a/13289118/11852173
- // yes this doesnt fully conform to xaml but whatever
- private void TextBox_KeyEnterUpdate(object sender, KeyEventArgs e)
- {
- if (e.Key == Key.Enter)
- {
- TextBox tBox = (TextBox)sender;
- DependencyProperty prop = TextBox.TextProperty;
-
- BindingExpression binding = BindingOperations.GetBindingExpression(tBox, prop);
-
- if (binding is not null)
- binding.UpdateSource();
- }
- }
}
}
diff --git a/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs
index d5fb042..78661f3 100644
--- a/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs
+++ b/Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs
@@ -1,7 +1,60 @@
-namespace Bloxstrap.UI.ViewModels.Menu
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+
+using Bloxstrap.Enums;
+using Bloxstrap.Extensions;
+using Bloxstrap.Models;
+
+namespace Bloxstrap.UI.ViewModels.Menu
{
- public class BehaviourViewModel
+ public class BehaviourViewModel : INotifyPropertyChanged
{
+ public event PropertyChangedEventHandler? PropertyChanged;
+ public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+
+ private bool _manualChannelEntry = !RobloxDeployment.SelectableChannels.Contains(App.Settings.Prop.Channel);
+
+ public BehaviourViewModel()
+ {
+ Task.Run(() => LoadChannelDeployInfo(App.Settings.Prop.Channel));
+ }
+
+ private async Task LoadChannelDeployInfo(string channel)
+ {
+ ChannelInfoLoadingText = "Fetching latest deploy info, please wait...";
+ OnPropertyChanged(nameof(ChannelInfoLoadingText));
+
+ ChannelDeployInfo = null;
+ OnPropertyChanged(nameof(ChannelDeployInfo));
+
+ try
+ {
+ ClientVersion info = await RobloxDeployment.GetInfo(channel, true);
+
+ ChannelDeployInfo = new DeployInfo
+ {
+ Version = info.Version,
+ VersionGuid = info.VersionGuid,
+ Timestamp = info.Timestamp?.ToFriendlyString()!
+ };
+
+ OnPropertyChanged(nameof(ChannelDeployInfo));
+ }
+ catch (Exception)
+ {
+ ChannelInfoLoadingText = "Failed to get deploy info.\nIs the channel name valid?";
+ OnPropertyChanged(nameof(ChannelInfoLoadingText));
+ }
+ }
+
+ public DeployInfo? ChannelDeployInfo { get; private set; } = null;
+ public string ChannelInfoLoadingText { get; private set; } = null!;
+
public bool CreateDesktopIcon
{
get => App.Settings.Prop.CreateDesktopIcon;
@@ -13,5 +66,56 @@
get => App.Settings.Prop.CheckForUpdates;
set => App.Settings.Prop.CheckForUpdates = value;
}
+
+ public IEnumerable Channels => RobloxDeployment.SelectableChannels;
+
+ public string Channel
+ {
+ get => App.Settings.Prop.Channel;
+ set
+ {
+ value = value.Trim();
+ Task.Run(() => LoadChannelDeployInfo(value));
+ App.Settings.Prop.Channel = value;
+ }
+ }
+
+ 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() == Channel.ToLowerInvariant()).FirstOrDefault();
+ Channel = string.IsNullOrEmpty(matchingChannel) ? RobloxDeployment.DefaultChannel : matchingChannel;
+ }
+
+ OnPropertyChanged(nameof(Channel));
+ OnPropertyChanged(nameof(ChannelComboBoxVisibility));
+ OnPropertyChanged(nameof(ChannelTextBoxVisibility));
+ }
+ }
+
+ // cant use data bindings so i have to do whatever tf this is
+ public Visibility ChannelComboBoxVisibility => ManualChannelEntry ? Visibility.Collapsed : Visibility.Visible;
+ public Visibility ChannelTextBoxVisibility => ManualChannelEntry ? Visibility.Visible : Visibility.Collapsed;
+
+ // todo - move to enum attributes?
+ public IReadOnlyDictionary ChannelChangeModes => new Dictionary
+ {
+ { "Change automatically", ChannelChangeMode.Automatic },
+ { "Always prompt", ChannelChangeMode.Prompt },
+ { "Never change", ChannelChangeMode.Ignore },
+ };
+
+ public string SelectedChannelChangeMode
+ {
+ get => ChannelChangeModes.FirstOrDefault(x => x.Value == App.Settings.Prop.ChannelChangeMode).Key;
+ set => App.Settings.Prop.ChannelChangeMode = ChannelChangeModes[value];
+ }
}
}
diff --git a/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs
index 43d33eb..5a659f7 100644
--- a/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs
+++ b/Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs
@@ -1,19 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
+using System.ComponentModel;
using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
-using Bloxstrap.Enums;
-using Bloxstrap.Extensions;
-using Bloxstrap.Models;
-
namespace Bloxstrap.UI.ViewModels.Menu
{
public class InstallationViewModel : INotifyPropertyChanged
@@ -21,47 +11,9 @@ namespace Bloxstrap.UI.ViewModels.Menu
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- private bool _manualChannelEntry = !RobloxDeployment.SelectableChannels.Contains(App.Settings.Prop.Channel);
-
public ICommand BrowseInstallLocationCommand => new RelayCommand(BrowseInstallLocation);
public ICommand OpenFolderCommand => new RelayCommand(OpenFolder);
- public DeployInfo? ChannelDeployInfo { get; private set; } = null;
- public string ChannelInfoLoadingText { get; private set; } = null!;
-
- public InstallationViewModel()
- {
- Task.Run(() => LoadChannelDeployInfo(App.Settings.Prop.Channel));
- }
-
- private async Task LoadChannelDeployInfo(string channel)
- {
- ChannelInfoLoadingText = "Fetching latest deploy info, please wait...";
- OnPropertyChanged(nameof(ChannelInfoLoadingText));
-
- ChannelDeployInfo = null;
- OnPropertyChanged(nameof(ChannelDeployInfo));
-
- try
- {
- ClientVersion info = await RobloxDeployment.GetInfo(channel, true);
-
- ChannelDeployInfo = new DeployInfo
- {
- Version = info.Version,
- VersionGuid = info.VersionGuid,
- Timestamp = info.Timestamp?.ToFriendlyString()!
- };
-
- OnPropertyChanged(nameof(ChannelDeployInfo));
- }
- catch (Exception)
- {
- ChannelInfoLoadingText = "Failed to get deploy info.\nIs the channel name valid?";
- OnPropertyChanged(nameof(ChannelInfoLoadingText));
- }
- }
-
private void BrowseInstallLocation()
{
using var dialog = new System.Windows.Forms.FolderBrowserDialog();
@@ -84,56 +36,5 @@ namespace Bloxstrap.UI.ViewModels.Menu
get => App.BaseDirectory;
set => App.BaseDirectory = value;
}
-
- public IEnumerable Channels => RobloxDeployment.SelectableChannels;
-
- public string Channel
- {
- get => App.Settings.Prop.Channel;
- set
- {
- value = value.Trim();
- Task.Run(() => LoadChannelDeployInfo(value));
- App.Settings.Prop.Channel = value;
- }
- }
-
- 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() == Channel.ToLowerInvariant()).FirstOrDefault();
- Channel = string.IsNullOrEmpty(matchingChannel) ? RobloxDeployment.DefaultChannel : matchingChannel;
- }
-
- OnPropertyChanged(nameof(Channel));
- OnPropertyChanged(nameof(ChannelComboBoxVisibility));
- OnPropertyChanged(nameof(ChannelTextBoxVisibility));
- }
- }
-
- // cant use data bindings so i have to do whatever tf this is
- public Visibility ChannelComboBoxVisibility => ManualChannelEntry ? Visibility.Collapsed : Visibility.Visible;
- public Visibility ChannelTextBoxVisibility => ManualChannelEntry ? Visibility.Visible : Visibility.Collapsed;
-
- // todo - move to enum attributes?
- public IReadOnlyDictionary ChannelChangeModes => new Dictionary
- {
- { "Change automatically", ChannelChangeMode.Automatic },
- { "Always prompt", ChannelChangeMode.Prompt },
- { "Never change", ChannelChangeMode.Ignore },
- };
-
- public string SelectedChannelChangeMode
- {
- get => ChannelChangeModes.FirstOrDefault(x => x.Value == App.Settings.Prop.ChannelChangeMode).Key;
- set => App.Settings.Prop.ChannelChangeMode = ChannelChangeModes[value];
- }
}
}