mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 18:11:27 -07:00
Add more options for channel change behaviour
This commit is contained in:
parent
b82241bbd3
commit
93694a5ff4
@ -13,6 +13,7 @@ using System.Windows;
|
||||
using Microsoft.Win32;
|
||||
|
||||
using Bloxstrap.Dialogs;
|
||||
using Bloxstrap.Enums;
|
||||
using Bloxstrap.Integrations;
|
||||
using Bloxstrap.Models;
|
||||
using Bloxstrap.Tools;
|
||||
@ -225,7 +226,7 @@ namespace Bloxstrap
|
||||
ClientVersion clientVersion = await Deployment.GetInfo(App.Settings.Prop.Channel);
|
||||
|
||||
// briefly check if current channel is suitable to use
|
||||
if (App.Settings.Prop.Channel.ToLower() != Deployment.DefaultChannel.ToLower())
|
||||
if (App.Settings.Prop.Channel.ToLower() != Deployment.DefaultChannel.ToLower() && App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Ignore)
|
||||
{
|
||||
string? switchDefaultPrompt = null;
|
||||
ClientVersion? defaultChannelInfo = null;
|
||||
@ -253,7 +254,7 @@ namespace Bloxstrap
|
||||
|
||||
if (!String.IsNullOrEmpty(switchDefaultPrompt))
|
||||
{
|
||||
MessageBoxResult result = !App.Settings.Prop.PromptChannelChange ? MessageBoxResult.Yes : App.ShowMessageBox(switchDefaultPrompt, MessageBoxImage.Question, MessageBoxButton.YesNo);
|
||||
MessageBoxResult result = App.Settings.Prop.ChannelChangeMode == ChannelChangeMode.Automatic ? MessageBoxResult.Yes : App.ShowMessageBox(switchDefaultPrompt, MessageBoxImage.Question, MessageBoxButton.YesNo);
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
|
9
Bloxstrap/Enums/ChannelChangeMode.cs
Normal file
9
Bloxstrap/Enums/ChannelChangeMode.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Bloxstrap.Enums
|
||||
{
|
||||
public enum ChannelChangeMode
|
||||
{
|
||||
Automatic,
|
||||
Prompt,
|
||||
Ignore
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ namespace Bloxstrap.Models
|
||||
|
||||
// channel configuration
|
||||
public string Channel { get; set; } = Deployment.DefaultChannel;
|
||||
public bool PromptChannelChange { get; set; } = false;
|
||||
public ChannelChangeMode ChannelChangeMode { get; set; } = ChannelChangeMode.Automatic;
|
||||
|
||||
// integration configuration
|
||||
public bool UseDiscordRichPresence { get; set; } = true;
|
||||
|
@ -6,6 +6,8 @@ using System.Windows;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
using Bloxstrap.Enums;
|
||||
|
||||
namespace Bloxstrap
|
||||
{
|
||||
static class ProtocolHandler
|
||||
@ -55,9 +57,9 @@ namespace Bloxstrap
|
||||
|
||||
if (key == "channel")
|
||||
{
|
||||
if (val.ToLower() != App.Settings.Prop.Channel.ToLower())
|
||||
if (val.ToLower() != App.Settings.Prop.Channel.ToLower() && App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Ignore)
|
||||
{
|
||||
MessageBoxResult result = !App.Settings.Prop.PromptChannelChange ? MessageBoxResult.Yes : App.ShowMessageBox(
|
||||
MessageBoxResult result = App.Settings.Prop.ChannelChangeMode == ChannelChangeMode.Automatic ? MessageBoxResult.Yes : App.ShowMessageBox(
|
||||
$"{App.ProjectName} was launched with the Roblox build channel set to {val}, however your current preferred channel is {App.Settings.Prop.Channel}.\n\n" +
|
||||
$"Would you like to switch channels from {App.Settings.Prop.Channel} to {val}?",
|
||||
MessageBoxImage.Question,
|
||||
|
@ -1,4 +1,9 @@
|
||||
namespace Bloxstrap.ViewModels
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Bloxstrap.Enums;
|
||||
|
||||
namespace Bloxstrap.ViewModels
|
||||
{
|
||||
public class BehaviourViewModel
|
||||
{
|
||||
@ -14,16 +19,24 @@
|
||||
set => App.Settings.Prop.CheckForUpdates = value;
|
||||
}
|
||||
|
||||
public bool ChannelChangePromptingEnabled
|
||||
{
|
||||
get => App.Settings.Prop.PromptChannelChange;
|
||||
set => App.Settings.Prop.PromptChannelChange = value;
|
||||
}
|
||||
|
||||
public bool MultiInstanceLaunchingEnabled
|
||||
{
|
||||
get => App.Settings.Prop.MultiInstanceLaunching;
|
||||
set => App.Settings.Prop.MultiInstanceLaunching = value;
|
||||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,11 +43,11 @@
|
||||
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="14" Text="Prompt on automatic channel change" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Bloxstrap may automatically change your preferred release channel. Enabling will ask you before changing." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
<TextBlock FontSize="14" Text="Choose what to do on suggested channel change" />
|
||||
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Roblox or Bloxstrap may try to change your preferred release channel." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<ui:ToggleSwitch IsChecked="{Binding ChannelChangePromptingEnabled, Mode=TwoWay}" />
|
||||
<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>
|
||||
</ui:UiPage>
|
||||
|
Loading…
Reference in New Issue
Block a user