fixes
This commit is contained in:
@@ -4,4 +4,5 @@ public class WorkspaceContext(IMainApi mainApi, IWorkspace? workspace)
|
|||||||
{
|
{
|
||||||
public IMainApi MainApi => mainApi;
|
public IMainApi MainApi => mainApi;
|
||||||
public IWorkspace? Workspace { get; set; } = workspace;
|
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);
|
await OnConfigure(context);
|
||||||
|
|
||||||
if (context?.Workspace?.Config is not null)
|
if (!context.Canceled && context.Workspace?.Config is not null)
|
||||||
context.Workspace.Config.ProviderId = Identifier;
|
context.Workspace.Config.ProviderId = Identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ internal class GitLabRepoWorkspaceFeature() : WorkspaceFeature("origin.gitlab",
|
|||||||
AppGlobals.Symbols.GetImageSource(AppSymbols.gitlab)))
|
AppGlobals.Symbols.GetImageSource(AppSymbols.gitlab)))
|
||||||
.Result is GitLabRepoWorkspaceConfig settingsNew)
|
.Result is GitLabRepoWorkspaceConfig settingsNew)
|
||||||
context.Workspace = new GitLabRepoWorkspace(settingsNew);
|
context.Workspace = new GitLabRepoWorkspace(settingsNew);
|
||||||
|
else
|
||||||
|
context.Canceled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnCreate(out IWorkspace workspace, WorkspaceConfig config)
|
protected override void OnCreate(out IWorkspace workspace, WorkspaceConfig config)
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
xmlns:langRes="clr-namespace:ModpackUpdater.Apps.Manager.LangRes"
|
xmlns:langRes="clr-namespace:ModpackUpdater.Apps.Manager.LangRes"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="ModpackUpdater.Apps.Manager.Ui.MainWindow"
|
x:Class="ModpackUpdater.Apps.Manager.Ui.MainWindow"
|
||||||
x:DataType="mainWindow:MainWindowViewModel"
|
|
||||||
Title="Minecraft Modpack Manager"
|
Title="Minecraft Modpack Manager"
|
||||||
WindowState="Maximized"
|
WindowState="Maximized"
|
||||||
Loaded="Window_OnLoaded"
|
Loaded="Window_OnLoaded"
|
||||||
@@ -18,6 +17,7 @@
|
|||||||
|
|
||||||
<Grid
|
<Grid
|
||||||
x:Name="GridMain"
|
x:Name="GridMain"
|
||||||
|
x:DataType="mainWindow:MainWindowViewModel"
|
||||||
RowDefinitions="Auto,*"
|
RowDefinitions="Auto,*"
|
||||||
ColumnDefinitions="Auto,*,500"
|
ColumnDefinitions="Auto,*,500"
|
||||||
RowSpacing="6"
|
RowSpacing="6"
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ public partial class MainWindow : Window, IMainApi
|
|||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
DataContext = Model;
|
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
GridMain.DataContext = Model;
|
||||||
|
|
||||||
ButtonWorkspace.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.workspace);
|
ButtonWorkspace.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.workspace);
|
||||||
MenuItemWorkspacePreferences.Icon = AppGlobals.Symbols.GetImage(AppSymbols.settings, SymbolSize.Small);
|
MenuItemWorkspacePreferences.Icon = AppGlobals.Symbols.GetImage(AppSymbols.settings, SymbolSize.Small);
|
||||||
MenuItemSaveWorkspace.Icon = AppGlobals.Symbols.GetImage(AppSymbols.save, 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);
|
var context = new WorkspaceContext(MainApi, null);
|
||||||
await feature.Configure(context);
|
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)
|
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);
|
var context = new WorkspaceContext(MainApi, Model.CurrentWorkspace);
|
||||||
await curWs.Configure(context);
|
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)
|
private async void MenuItemSaveWorkspace_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user