fixes
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,7 +124,8 @@ public partial class MainWindow : Window, IMainApi
|
||||
|
||||
var context = new WorkspaceContext(MainApi, null);
|
||||
await feature.Configure(context);
|
||||
await LoadNewWorkspace(context.Workspace, feature);
|
||||
if (!context.Canceled)
|
||||
await LoadNewWorkspace(context.Workspace, feature);
|
||||
}
|
||||
|
||||
private async void MenuItemWorkspacePreferences_OnClick(object? sender, RoutedEventArgs e)
|
||||
@@ -134,7 +135,8 @@ public partial class MainWindow : Window, IMainApi
|
||||
|
||||
var context = new WorkspaceContext(MainApi, Model.CurrentWorkspace);
|
||||
await curWs.Configure(context);
|
||||
await LoadNewWorkspace(context.Workspace, curWs);
|
||||
if (!context.Canceled)
|
||||
await LoadNewWorkspace(context.Workspace, curWs);
|
||||
}
|
||||
|
||||
private async void MenuItemSaveWorkspace_OnClick(object? sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user