mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Move channel selection to Behaviour tab
This commit is contained in:
parent
50762772af
commit
431c07ee07
@ -9,9 +9,9 @@
|
|||||||
Title="BehaviourPage"
|
Title="BehaviourPage"
|
||||||
Scrollable="True">
|
Scrollable="True">
|
||||||
<StackPanel Margin="0,0,14,14">
|
<StackPanel Margin="0,0,14,14">
|
||||||
<TextBlock Text="Configure what Bloxstrap should do when starting up." FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
|
<TextBlock Margin="0,0,0,8" Text="Configure what Bloxstrap should do when launching." FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||||
|
|
||||||
<ui:CardControl Margin="0,16,0,0">
|
<ui:CardControl Margin="0,8,0,0">
|
||||||
<ui:CardControl.Header>
|
<ui:CardControl.Header>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock FontSize="14" Text="Create desktop icon" />
|
<TextBlock FontSize="14" Text="Create desktop icon" />
|
||||||
@ -20,6 +20,7 @@
|
|||||||
</ui:CardControl.Header>
|
</ui:CardControl.Header>
|
||||||
<ui:ToggleSwitch IsChecked="{Binding CreateDesktopIcon, Mode=TwoWay}" />
|
<ui:ToggleSwitch IsChecked="{Binding CreateDesktopIcon, Mode=TwoWay}" />
|
||||||
</ui:CardControl>
|
</ui:CardControl>
|
||||||
|
|
||||||
<ui:CardControl Margin="0,8,0,0">
|
<ui:CardControl Margin="0,8,0,0">
|
||||||
<ui:CardControl.Header>
|
<ui:CardControl.Header>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
@ -29,5 +30,90 @@
|
|||||||
</ui:CardControl.Header>
|
</ui:CardControl.Header>
|
||||||
<ui:ToggleSwitch IsChecked="{Binding UpdateCheckingEnabled, Mode=TwoWay}" />
|
<ui:ToggleSwitch IsChecked="{Binding UpdateCheckingEnabled, Mode=TwoWay}" />
|
||||||
</ui:CardControl>
|
</ui:CardControl>
|
||||||
|
|
||||||
|
<ui:CardExpander Margin="0,8,0,0" IsExpanded="True">
|
||||||
|
<ui:CardExpander.Header>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Column="0">
|
||||||
|
<TextBlock FontSize="14" Text="Deployment channel" />
|
||||||
|
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Choose which release channel Roblox should be downloaded from." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||||
|
</StackPanel>
|
||||||
|
<ComboBox Grid.Column="1" Margin="8,0,8,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding Channels, Mode=OneWay}" SelectedItem="{Binding Channel, Mode=TwoWay}" Visibility="{Binding ChannelComboBoxVisibility, Mode=OneWay}" />
|
||||||
|
<ui:TextBox Grid.Column="1" Margin="8,0,8,0" Padding="10,5,10,5" Width="200" Text="{Binding Channel, Mode=TwoWay}" Visibility="{Binding ChannelTextBoxVisibility, Mode=OneWay}" KeyUp="TextBox_KeyEnterUpdate" />
|
||||||
|
</Grid>
|
||||||
|
</ui:CardExpander.Header>
|
||||||
|
<StackPanel>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid Column="0" Margin="0,0,4,0">
|
||||||
|
<Grid.Style>
|
||||||
|
<Style>
|
||||||
|
<Setter Property="Grid.Visibility" Value="Visible"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ChannelDeployInfo}" Value="{x:Null}">
|
||||||
|
<Setter Property="Grid.Visibility" Value="Collapsed" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Grid.Style>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="0" Margin="0,0,16,8" VerticalAlignment="Center" Text="Version" />
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="1" Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="{Binding ChannelDeployInfo.Version, Mode=OneWay}" />
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" Margin="0,0,16,8" VerticalAlignment="Center" Text="VersionGuid" />
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="1" Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="{Binding ChannelDeployInfo.VersionGuid, Mode=OneWay}" />
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="0" Margin="0,0,16,0" VerticalAlignment="Center" Text="Deployed" />
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="1" Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="{Binding ChannelDeployInfo.Timestamp, Mode=OneWay}" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Column="0">
|
||||||
|
<Grid.Style>
|
||||||
|
<Style>
|
||||||
|
<Setter Property="Grid.Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ChannelDeployInfo}" Value="{x:Null}">
|
||||||
|
<Setter Property="Grid.Visibility" Value="Visible" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Grid.Style>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ui:ProgressRing Grid.Column="0" Margin="6" IsIndeterminate="True" />
|
||||||
|
<TextBlock Grid.Column="1" Margin="16" VerticalAlignment="Center" Text="{Binding ChannelInfoLoadingText, Mode=OneWay}" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<CheckBox Grid.Column="1" Margin="4,0,0,0" Content="Manually enter channel name" VerticalAlignment="Top" IsChecked="{Binding ManualChannelEntry, Mode=TwoWay}" />
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</ui:CardExpander>
|
||||||
|
|
||||||
|
<ui:CardControl Margin="0,8,0,0">
|
||||||
|
<ui:CardControl.Header>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock FontSize="14" Text="Automatic channel change action" />
|
||||||
|
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Roblox or Bloxstrap may try to change your preferred channel." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||||
|
</StackPanel>
|
||||||
|
</ui:CardControl.Header>
|
||||||
|
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding ChannelChangeModes.Keys, Mode=OneTime}" Text="{Binding SelectedChannelChangeMode, Mode=TwoWay}" />
|
||||||
|
</ui:CardControl>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ui:UiPage>
|
</ui:UiPage>
|
||||||
|
@ -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
|
namespace Bloxstrap.UI.Menu.Pages
|
||||||
{
|
{
|
||||||
@ -12,5 +17,21 @@ namespace Bloxstrap.UI.Menu.Pages
|
|||||||
DataContext = new BehaviourViewModel();
|
DataContext = new BehaviourViewModel();
|
||||||
InitializeComponent();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
Title="InstallationPage"
|
Title="InstallationPage"
|
||||||
Scrollable="True">
|
Scrollable="True">
|
||||||
<StackPanel Margin="0,0,14,14">
|
<StackPanel Margin="0,0,14,14">
|
||||||
<TextBlock Text="Configure how Bloxstrap and Roblox are installed." FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
|
<TextBlock Text="Configure how Bloxstrap/Roblox is installed." FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||||
|
|
||||||
<ui:CardExpander Margin="0,16,0,0">
|
<ui:CardExpander Margin="0,16,0,0">
|
||||||
<ui:CardExpander.Header>
|
<ui:CardExpander.Header>
|
||||||
@ -46,89 +46,5 @@
|
|||||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Opens the folder that Bloxstrap is currently installed to." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Opens the folder that Bloxstrap is currently installed to." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ui:CardAction>
|
</ui:CardAction>
|
||||||
|
|
||||||
<ui:CardExpander Margin="0,8,0,0" IsExpanded="True">
|
|
||||||
<ui:CardExpander.Header>
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<StackPanel Grid.Column="0">
|
|
||||||
<TextBlock FontSize="14" Text="Channel" />
|
|
||||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Choose which release channel to download Roblox from." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
|
||||||
</StackPanel>
|
|
||||||
<ComboBox Grid.Column="1" Margin="8,0,8,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding Channels, Mode=OneWay}" SelectedItem="{Binding Channel, Mode=TwoWay}" Visibility="{Binding ChannelComboBoxVisibility, Mode=OneWay}" />
|
|
||||||
<ui:TextBox Grid.Column="1" Margin="8,0,8,0" Padding="10,5,10,5" Width="200" Text="{Binding Channel, Mode=TwoWay}" Visibility="{Binding ChannelTextBoxVisibility, Mode=OneWay}" KeyUp="TextBox_KeyEnterUpdate" />
|
|
||||||
</Grid>
|
|
||||||
</ui:CardExpander.Header>
|
|
||||||
<StackPanel>
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid Column="0" Margin="0,0,4,0">
|
|
||||||
<Grid.Style>
|
|
||||||
<Style>
|
|
||||||
<Setter Property="Grid.Visibility" Value="Visible"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding ChannelDeployInfo}" Value="{x:Null}">
|
|
||||||
<Setter Property="Grid.Visibility" Value="Collapsed" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Grid.Style>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="0,0,16,8" VerticalAlignment="Center" Text="Version" />
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="1" Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="{Binding ChannelDeployInfo.Version, Mode=OneWay}" />
|
|
||||||
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" Margin="0,0,16,8" VerticalAlignment="Center" Text="VersionGuid" />
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="1" Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="{Binding ChannelDeployInfo.VersionGuid, Mode=OneWay}" />
|
|
||||||
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" Margin="0,0,16,0" VerticalAlignment="Center" Text="Deployed" />
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="1" Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="{Binding ChannelDeployInfo.Timestamp, Mode=OneWay}" />
|
|
||||||
</Grid>
|
|
||||||
<Grid Column="0">
|
|
||||||
<Grid.Style>
|
|
||||||
<Style>
|
|
||||||
<Setter Property="Grid.Visibility" Value="Collapsed"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding ChannelDeployInfo}" Value="{x:Null}">
|
|
||||||
<Setter Property="Grid.Visibility" Value="Visible" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Grid.Style>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<ui:ProgressRing Grid.Column="0" Margin="6" IsIndeterminate="True" />
|
|
||||||
<TextBlock Grid.Column="1" Margin="16" VerticalAlignment="Center" Text="{Binding ChannelInfoLoadingText, Mode=OneWay}" />
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<CheckBox Grid.Column="1" Margin="4,0,0,0" Content="Manually enter channel name" VerticalAlignment="Top" IsChecked="{Binding ManualChannelEntry, Mode=TwoWay}" />
|
|
||||||
</Grid>
|
|
||||||
</StackPanel>
|
|
||||||
</ui:CardExpander>
|
|
||||||
<ui:CardControl Margin="0,8,0,0">
|
|
||||||
<ui:CardControl.Header>
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock FontSize="14" Text="Automatic channel change action" />
|
|
||||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Roblox or Bloxstrap may try to change your preferred channel." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
|
||||||
</StackPanel>
|
|
||||||
</ui:CardControl.Header>
|
|
||||||
<ComboBox Margin="5,0,0,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding ChannelChangeModes.Keys, Mode=OneTime}" Text="{Binding SelectedChannelChangeMode, Mode=TwoWay}" />
|
|
||||||
</ui:CardControl>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ui:UiPage>
|
</ui:UiPage>
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
using System.Windows;
|
using Bloxstrap.UI.ViewModels.Menu;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
using Bloxstrap.UI.ViewModels.Menu;
|
|
||||||
|
|
||||||
namespace Bloxstrap.UI.Menu.Pages
|
namespace Bloxstrap.UI.Menu.Pages
|
||||||
{
|
{
|
||||||
@ -17,21 +12,5 @@ namespace Bloxstrap.UI.Menu.Pages
|
|||||||
DataContext = new InstallationViewModel();
|
DataContext = new InstallationViewModel();
|
||||||
InitializeComponent();
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
public bool CreateDesktopIcon
|
||||||
{
|
{
|
||||||
get => App.Settings.Prop.CreateDesktopIcon;
|
get => App.Settings.Prop.CreateDesktopIcon;
|
||||||
@ -13,5 +66,56 @@
|
|||||||
get => App.Settings.Prop.CheckForUpdates;
|
get => App.Settings.Prop.CheckForUpdates;
|
||||||
set => App.Settings.Prop.CheckForUpdates = value;
|
set => App.Settings.Prop.CheckForUpdates = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> 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<string, ChannelChangeMode> ChannelChangeModes => new Dictionary<string, ChannelChangeMode>
|
||||||
|
{
|
||||||
|
{ "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];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,9 @@
|
|||||||
using System;
|
using System.ComponentModel;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
using Bloxstrap.Enums;
|
|
||||||
using Bloxstrap.Extensions;
|
|
||||||
using Bloxstrap.Models;
|
|
||||||
|
|
||||||
namespace Bloxstrap.UI.ViewModels.Menu
|
namespace Bloxstrap.UI.ViewModels.Menu
|
||||||
{
|
{
|
||||||
public class InstallationViewModel : INotifyPropertyChanged
|
public class InstallationViewModel : INotifyPropertyChanged
|
||||||
@ -21,47 +11,9 @@ namespace Bloxstrap.UI.ViewModels.Menu
|
|||||||
public event PropertyChangedEventHandler? PropertyChanged;
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
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 BrowseInstallLocationCommand => new RelayCommand(BrowseInstallLocation);
|
||||||
public ICommand OpenFolderCommand => new RelayCommand(OpenFolder);
|
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()
|
private void BrowseInstallLocation()
|
||||||
{
|
{
|
||||||
using var dialog = new System.Windows.Forms.FolderBrowserDialog();
|
using var dialog = new System.Windows.Forms.FolderBrowserDialog();
|
||||||
@ -84,56 +36,5 @@ namespace Bloxstrap.UI.ViewModels.Menu
|
|||||||
get => App.BaseDirectory;
|
get => App.BaseDirectory;
|
||||||
set => App.BaseDirectory = value;
|
set => App.BaseDirectory = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<string> 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<string, ChannelChangeMode> ChannelChangeModes => new Dictionary<string, ChannelChangeMode>
|
|
||||||
{
|
|
||||||
{ "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];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user