optimizations

This commit is contained in:
2025-11-17 16:54:15 +01:00
parent cd1006b422
commit ce09b47456
5 changed files with 26 additions and 3 deletions

View File

@@ -15,4 +15,9 @@ public partial class GitLabRepoWorkspaceConfigEditorView : AvaloniaFlyoutBase
DataContext = settings;
InitializeComponent();
}
protected override object? GetResult()
{
return Settings;
}
}

View File

@@ -24,7 +24,8 @@ internal class LocalFolderWorkspace(LocalFolderWorkspaceConfig config) : IWorksp
rawUpdateInfos = await GetContent(ConfigX.FileLocationUpdateJson);
UpdateInfos = UpdateInfos.Parse(rawUpdateInfos);
ConfigX.FolderName = Path.GetFileName(ConfigX.RootFolderPath);
if (string.IsNullOrWhiteSpace(ConfigX.FolderName))
ConfigX.FolderName = Path.GetFileName(ConfigX.RootFolderPath);
return InstallInfos != null && UpdateInfos != null;
}

View File

@@ -15,6 +15,9 @@
<dialogs:AvaloniaFlyoutBase.MainContent>
<StackPanel Spacing="6">
<Label Target="TextBoxName" Content="{x:Static langRes:GeneralLangRes.Name}"/>
<TextBox Name="TextBoxName" Text="{Binding FolderName}"/>
<Label Target="TextBoxRootFolderPath" Content="{x:Static langRes:GeneralLangRes.RootFolderPath}"/>
<Grid
ColumnDefinitions="*,Auto"

View File

@@ -22,6 +22,11 @@ public partial class LocalFolderWorkspaceConfigEditorView : AvaloniaFlyoutBase
ButtonSearch.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.opened_folder);
}
protected override object? GetResult()
{
return Settings;
}
private async void ButtonSearch_OnClick(object? sender, RoutedEventArgs e)
{
if (TopLevel.GetTopLevel(this) is not { } topLevel)
@@ -33,7 +38,12 @@ public partial class LocalFolderWorkspaceConfigEditorView : AvaloniaFlyoutBase
AllowMultiple = false,
});
if (filePaths.Count >= 1)
TextBoxRootFolderPath.Text = filePaths[0].Path.AbsolutePath;
if (filePaths.Count < 1)
return;
TextBoxRootFolderPath.Text = filePaths[0].Path.AbsolutePath;
if (string.IsNullOrWhiteSpace(TextBoxName.Text))
TextBoxName.Text = filePaths[0].Name;
}
}

View File

@@ -1,3 +1,4 @@
using System.Reflection;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Media;
@@ -7,6 +8,7 @@ using ModpackUpdater.Apps.Manager.Api.Plugins.Features;
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
using ModpackUpdater.Apps.Manager.Settings;
using ModpackUpdater.Apps.Manager.Ui.Models.MainWindow;
using Pilz.Extensions;
using Pilz.Features;
using Pilz.UI.AvaloniaUI.Features;
using Pilz.UI.Symbols;
@@ -29,6 +31,8 @@ public partial class MainWindow : Window, IMainApi
{
InitializeComponent();
Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion().ToShortString()})";
GridMain.DataContext = Model;
ButtonWorkspace.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.workspace);