diff --git a/Bloxstrap/UI/Menu/ViewModels/InstallationViewModel.cs b/Bloxstrap/UI/Menu/ViewModels/InstallationViewModel.cs index cfd75b57..3b5c0205 100644 --- a/Bloxstrap/UI/Menu/ViewModels/InstallationViewModel.cs +++ b/Bloxstrap/UI/Menu/ViewModels/InstallationViewModel.cs @@ -6,7 +6,6 @@ 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 @@ private async Task LoadChannelDeployInfo(string channel) 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 @@ public string Channel get => App.Settings.Prop.Channel; set { + value = value.Trim(); Task.Run(() => LoadChannelDeployInfo(value)); App.Settings.Prop.Channel = value; } diff --git a/Bloxstrap/UI/Menu/Views/Pages/InstallationPage.xaml b/Bloxstrap/UI/Menu/Views/Pages/InstallationPage.xaml index 81a9bac1..dbce9db3 100644 --- a/Bloxstrap/UI/Menu/Views/Pages/InstallationPage.xaml +++ b/Bloxstrap/UI/Menu/Views/Pages/InstallationPage.xaml @@ -59,7 +59,7 @@ - + diff --git a/Bloxstrap/UI/Menu/Views/Pages/InstallationPage.xaml.cs b/Bloxstrap/UI/Menu/Views/Pages/InstallationPage.xaml.cs index 19c7d32f..84d03e5e 100644 --- a/Bloxstrap/UI/Menu/Views/Pages/InstallationPage.xaml.cs +++ b/Bloxstrap/UI/Menu/Views/Pages/InstallationPage.xaml.cs @@ -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 @@ public InstallationPage() 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(); + } + } } }