mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Improve channel input selection handling
input value is now trimmed, as well as input being processed on enter
This commit is contained in:
parent
fe885cb24b
commit
991005c6a7
@ -6,7 +6,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
@ -65,9 +64,9 @@ namespace Bloxstrap.UI.Menu.ViewModels
|
||||
|
||||
private void BrowseInstallLocation()
|
||||
{
|
||||
using var dialog = new FolderBrowserDialog();
|
||||
using var dialog = new System.Windows.Forms.FolderBrowserDialog();
|
||||
|
||||
if (dialog.ShowDialog() != DialogResult.OK)
|
||||
if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
|
||||
return;
|
||||
|
||||
if (!dialog.SelectedPath.EndsWith(App.ProjectName))
|
||||
@ -96,6 +95,7 @@ namespace Bloxstrap.UI.Menu.ViewModels
|
||||
get => App.Settings.Prop.Channel;
|
||||
set
|
||||
{
|
||||
value = value.Trim();
|
||||
Task.Run(() => LoadChannelDeployInfo(value));
|
||||
App.Settings.Prop.Channel = value;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@
|
||||
<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}" />
|
||||
<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>
|
||||
|
@ -1,4 +1,9 @@
|
||||
using Bloxstrap.UI.Menu.ViewModels;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
|
||||
using Bloxstrap.UI.Menu.ViewModels;
|
||||
|
||||
namespace Bloxstrap.UI.Menu.Views.Pages
|
||||
{
|
||||
@ -12,5 +17,21 @@ namespace Bloxstrap.UI.Menu.Views.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user