This commit is contained in:
2025-11-17 15:59:49 +01:00
parent d68df750a6
commit fb36f897d6
5 changed files with 11 additions and 6 deletions

View File

@@ -4,4 +4,5 @@ public class WorkspaceContext(IMainApi mainApi, IWorkspace? workspace)
{
public IMainApi MainApi => mainApi;
public IWorkspace? Workspace { get; set; } = workspace;
public bool Canceled { get; set; }
}

View File

@@ -14,7 +14,7 @@ public abstract class WorkspaceFeature(string identifier, string name) : PluginF
{
await OnConfigure(context);
if (context?.Workspace?.Config is not null)
if (!context.Canceled && context.Workspace?.Config is not null)
context.Workspace.Config.ProviderId = Identifier;
}

View File

@@ -24,6 +24,8 @@ internal class GitLabRepoWorkspaceFeature() : WorkspaceFeature("origin.gitlab",
AppGlobals.Symbols.GetImageSource(AppSymbols.gitlab)))
.Result is GitLabRepoWorkspaceConfig settingsNew)
context.Workspace = new GitLabRepoWorkspace(settingsNew);
else
context.Canceled = true;
}
protected override void OnCreate(out IWorkspace workspace, WorkspaceConfig config)

View File

@@ -10,7 +10,6 @@
xmlns:langRes="clr-namespace:ModpackUpdater.Apps.Manager.LangRes"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="ModpackUpdater.Apps.Manager.Ui.MainWindow"
x:DataType="mainWindow:MainWindowViewModel"
Title="Minecraft Modpack Manager"
WindowState="Maximized"
Loaded="Window_OnLoaded"
@@ -18,6 +17,7 @@
<Grid
x:Name="GridMain"
x:DataType="mainWindow:MainWindowViewModel"
RowDefinitions="Auto,*"
ColumnDefinitions="Auto,*,500"
RowSpacing="6"

View File

@@ -27,10 +27,10 @@ public partial class MainWindow : Window, IMainApi
public MainWindow()
{
DataContext = Model;
InitializeComponent();
GridMain.DataContext = Model;
ButtonWorkspace.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.workspace);
MenuItemWorkspacePreferences.Icon = AppGlobals.Symbols.GetImage(AppSymbols.settings, SymbolSize.Small);
MenuItemSaveWorkspace.Icon = AppGlobals.Symbols.GetImage(AppSymbols.save, SymbolSize.Small);
@@ -124,6 +124,7 @@ public partial class MainWindow : Window, IMainApi
var context = new WorkspaceContext(MainApi, null);
await feature.Configure(context);
if (!context.Canceled)
await LoadNewWorkspace(context.Workspace, feature);
}
@@ -134,6 +135,7 @@ public partial class MainWindow : Window, IMainApi
var context = new WorkspaceContext(MainApi, Model.CurrentWorkspace);
await curWs.Configure(context);
if (!context.Canceled)
await LoadNewWorkspace(context.Workspace, curWs);
}