mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-05-13 03:34:42 -07:00
Add manual channel entry (#132)
This commit is contained in:
parent
7fa4a0b989
commit
1f40efd10d
@ -19,35 +19,16 @@ namespace Bloxstrap.Helpers
|
||||
public string BaseUrl { get; private set; } = DefaultBaseUrl;
|
||||
public string Channel { get; private set; } = DefaultChannel;
|
||||
|
||||
// basically any channel that has had a deploy within the past month with a windowsplayer build
|
||||
public static readonly List<string> ChannelsAbstracted = new()
|
||||
// most commonly used/interesting channels
|
||||
public static readonly List<string> SelectableChannels = new()
|
||||
{
|
||||
"LIVE",
|
||||
"ZNext",
|
||||
"ZCanary",
|
||||
"ZIntegration"
|
||||
};
|
||||
|
||||
// why not?
|
||||
public static readonly List<string> ChannelsAll = new()
|
||||
{
|
||||
"LIVE",
|
||||
"ZAvatarTeam",
|
||||
"ZAvatarRelease",
|
||||
"ZCanary",
|
||||
"ZCanary1",
|
||||
"ZCanary2",
|
||||
"ZCanary3",
|
||||
"ZCanaryApps",
|
||||
"ZFlag",
|
||||
"ZIntegration",
|
||||
"ZIntegration1",
|
||||
"ZLive",
|
||||
"ZLive1",
|
||||
"ZNext",
|
||||
"ZSocialTeam",
|
||||
"ZStudioInt1",
|
||||
"ZStudioInt2"
|
||||
"ZCanary",
|
||||
"ZIntegration",
|
||||
"ZAvatarTeam",
|
||||
"ZSocialTeam"
|
||||
};
|
||||
#endregion
|
||||
|
||||
|
@ -1,17 +1,15 @@
|
||||
using Bloxstrap.Enums;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Windows.Forms;
|
||||
using Wpf.Ui.Mvvm.Interfaces;
|
||||
using System.ComponentModel;
|
||||
using Bloxstrap.Helpers;
|
||||
using Bloxstrap.Models;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Bloxstrap.ViewModels
|
||||
{
|
||||
@ -20,14 +18,13 @@ namespace Bloxstrap.ViewModels
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
|
||||
private IEnumerable<string> _channels = DeployManager.ChannelsAbstracted.Contains(App.Settings.Prop.Channel) ? DeployManager.ChannelsAbstracted : DeployManager.ChannelsAll;
|
||||
private bool _showAllChannels = !DeployManager.ChannelsAbstracted.Contains(App.Settings.Prop.Channel);
|
||||
private bool _manualChannelEntry = !DeployManager.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; //new DeployInfo(){ Version = "hi", VersionGuid = "hi", Timestamp = "January 25 2023 at 6:03:48 PM" };
|
||||
public DeployInfo? ChannelDeployInfo { get; private set; } = null;
|
||||
public string ChannelInfoLoadingText { get; private set; } = null!;
|
||||
|
||||
public InstallationViewModel()
|
||||
{
|
||||
@ -36,20 +33,32 @@ namespace Bloxstrap.ViewModels
|
||||
|
||||
private async Task LoadChannelDeployInfo(string channel)
|
||||
{
|
||||
ChannelInfoLoadingText = "Fetching latest deploy info, please wait...";
|
||||
OnPropertyChanged(nameof(ChannelInfoLoadingText));
|
||||
|
||||
ChannelDeployInfo = null;
|
||||
OnPropertyChanged(nameof(ChannelDeployInfo));
|
||||
|
||||
App.DeployManager.SetChannel(channel);
|
||||
ClientVersion info = await App.DeployManager.GetLastDeploy(true);
|
||||
|
||||
ChannelDeployInfo = new DeployInfo
|
||||
try
|
||||
{
|
||||
Version = info.Version,
|
||||
VersionGuid = info.VersionGuid,
|
||||
Timestamp = info.Timestamp?.ToString("dddd, d MMMM yyyy 'at' h:mm:ss tt", App.CultureFormat)!
|
||||
};
|
||||
ClientVersion info = await App.DeployManager.GetLastDeploy(true);
|
||||
|
||||
OnPropertyChanged(nameof(ChannelDeployInfo));
|
||||
ChannelDeployInfo = new DeployInfo
|
||||
{
|
||||
Version = info.Version,
|
||||
VersionGuid = info.VersionGuid,
|
||||
Timestamp = info.Timestamp?.ToString("dddd, d MMMM yyyy 'at' h:mm:ss tt", App.CultureFormat)!
|
||||
};
|
||||
|
||||
OnPropertyChanged(nameof(ChannelDeployInfo));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
ChannelInfoLoadingText = "Failed to get deploy info.\nIs the channel name valid?";
|
||||
OnPropertyChanged(nameof(ChannelInfoLoadingText));
|
||||
}
|
||||
}
|
||||
|
||||
private void BrowseInstallLocation()
|
||||
@ -74,53 +83,36 @@ namespace Bloxstrap.ViewModels
|
||||
set => App.BaseDirectory = value;
|
||||
}
|
||||
|
||||
public IEnumerable<string> Channels
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_channels == DeployManager.ChannelsAll && !_channels.Contains(App.Settings.Prop.Channel))
|
||||
_channels = _channels.Append(App.Settings.Prop.Channel);
|
||||
|
||||
return _channels;
|
||||
}
|
||||
set => _channels = value;
|
||||
}
|
||||
public IEnumerable<string> Channels => DeployManager.SelectableChannels;
|
||||
|
||||
public string Channel
|
||||
{
|
||||
get => App.Settings.Prop.Channel;
|
||||
set
|
||||
{
|
||||
//Task.Run(() => GetChannelInfo(value));
|
||||
Task.Run(() => LoadChannelDeployInfo(value));
|
||||
App.Settings.Prop.Channel = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowAllChannels
|
||||
public bool ManualChannelEntry
|
||||
{
|
||||
get => _showAllChannels;
|
||||
get => _manualChannelEntry;
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
Channels = DeployManager.ChannelsAll;
|
||||
}
|
||||
else
|
||||
{
|
||||
Channels = DeployManager.ChannelsAbstracted;
|
||||
_manualChannelEntry = value;
|
||||
|
||||
if (!Channels.Contains(Channel))
|
||||
{
|
||||
Channel = DeployManager.DefaultChannel;
|
||||
OnPropertyChanged(nameof(Channel));
|
||||
}
|
||||
}
|
||||
if (!value && !Channels.Contains(Channel))
|
||||
Channel = DeployManager.DefaultChannel;
|
||||
|
||||
OnPropertyChanged(nameof(Channels));
|
||||
|
||||
_showAllChannels = value;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,8 @@
|
||||
<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}" Text="{Binding Channel, Mode=TwoWay}" />
|
||||
<ComboBox Grid.Column="1" Margin="8,0,8,0" Padding="10,5,10,5" Width="200" ItemsSource="{Binding Channels, Mode=OneWay}" Text="{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}" />
|
||||
</Grid>
|
||||
</ui:CardExpander.Header>
|
||||
<StackPanel>
|
||||
@ -114,10 +115,10 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:ProgressRing Grid.Column="0" Margin="6" IsIndeterminate="True" />
|
||||
<TextBlock Grid.Column="1" Margin="16" VerticalAlignment="Center" Text="Fetching latest deploy info, please wait..." />
|
||||
<TextBlock Grid.Column="1" Margin="16" VerticalAlignment="Center" Text="{Binding ChannelInfoLoadingText, Mode=OneWay}" />
|
||||
</Grid>
|
||||
|
||||
<CheckBox Grid.Column="1" Margin="4,0,0,0" Content="Show all available channels" VerticalAlignment="Top" IsChecked="{Binding ShowAllChannels, Mode=TwoWay}" />
|
||||
<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>
|
||||
|
@ -135,7 +135,7 @@
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="14" Text="Use alternate graphics quality selector" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Toggle between using the consolidated 0-10 / fine-grained 0-21 graphics quality slider." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Toggle between using the consolidated 1-10 / fine-grained 1-21 graphics quality slider." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<ui:ToggleSwitch IsChecked="{Binding AlternateGraphicsSelectorEnabled, Mode=TwoWay}" />
|
||||
|
Loading…
Reference in New Issue
Block a user