Files
minecraft-modpack-updater/ModpackUpdater.Apps.Manager/Features/Workspaces/GitLabRepo/GitLabRepoWorkspaceFeature.cs
Pilzinsel64 433613e43d ui: migrate client back to WinForms
-> let's use wine for comatibility again
-> easier to maintain
-> easier to build dynamic options with
2025-06-29 20:03:02 +02:00

40 lines
1.5 KiB
C#

using ModpackUpdater.Apps.Manager.Api.Model;
using ModpackUpdater.Apps.Manager.Api.Plugins.Features;
using ModpackUpdater.Apps.Manager.LangRes;
using Pilz.Plugins.Advanced;
using Pilz.UI.Symbols;
using Pilz.UI.WinForms.Extensions;
using Pilz.UI.WinForms.Telerik.Dialogs;
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.GitLabRepo;
internal class GitLabRepoWorkspaceFeature : WorkspaceFeature, IPluginFeatureProvider<GitLabRepoWorkspaceFeature>
{
public static GitLabRepoWorkspaceFeature Instance { get; } = new();
public GitLabRepoWorkspaceFeature() : base("origin.gitlab", FeatureNamesLangRes.GitLabWorkspace)
{
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.gitlab, SymbolSize.Small);
}
protected override bool OnConfigure(ref IWorkspace? workspace)
{
var settings = workspace?.Config as GitLabRepoWorkspaceConfig ?? new();
if (RadDialogBase.ShowDialog(new GitLabRepoWorkspaceConfigEditor(settings), TitlesLangRes.GitLabRepoWorkspaceEditor, AppGlobals.Symbols.GetSvgImage(AppSymbols.gitlab, SymbolSize.Small)).Result.IsNotOk())
return false;
workspace = new GitLabRepoWorkspace(settings);
return true;
}
protected override void OnCreate(out IWorkspace workspace, WorkspaceConfig config)
{
if (config is not GitLabRepoWorkspaceConfig gitlabConfig)
throw new NotImplementedException($"Only configs of type {typeof(GitLabRepoWorkspaceConfig).Name} are allowed.");
workspace = new GitLabRepoWorkspace(gitlabConfig);
}
}