a lot of work
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.Api;
|
||||
using ModpackUpdater.Apps.Manager.Api.Plugins.Params;
|
||||
using ModpackUpdater.Apps.Manager.LangRes;
|
||||
using ModpackUpdater.Apps.Manager.Ui.Models;
|
||||
using MsBox.Avalonia;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using Pilz.Features;
|
||||
using Telerik.WinControls;
|
||||
using Pilz.UI.Symbols;
|
||||
|
||||
namespace ModpackUpdater.Apps.Manager.Features.Tools;
|
||||
|
||||
@@ -11,20 +15,23 @@ internal class GenerateChangelogFeature : PluginFunction, IPluginFeatureProvider
|
||||
|
||||
public GenerateChangelogFeature() : base(FeatureTypes.Tools, "origin.genchangelog", FeatureNamesLangRes.GenerateChangelogFeature)
|
||||
{
|
||||
Icon = AppGlobals.Symbols.GetSvgImage(AppSymbols.time_machine, Pilz.UI.Symbols.SymbolSize.Small);
|
||||
Icon = AppGlobals.Symbols.GetImage(AppSymbols.time_machine, SymbolSize.Small);
|
||||
}
|
||||
|
||||
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
|
||||
{
|
||||
if (@params is not MainApiParameters p || p.Api.CurWorkspace?.InstallInfos is null || p.Api.CurActionSet is not UpdateInfo updateInfos)
|
||||
if (@params is not MainApiParameters p
|
||||
|| p.Api.Model.CurrentWorkspace?.InstallInfos is null
|
||||
|| p.Api.Model.SelectedTreeNode is not ActionSetTreeNode node
|
||||
|| node.Infos is not UpdateInfo updateInfo)
|
||||
return null;
|
||||
|
||||
var changelog = SharedFunctions.GenerateChangelog(p.Api.CurWorkspace.InstallInfos, updateInfos);
|
||||
if (!string.IsNullOrWhiteSpace(changelog))
|
||||
{
|
||||
Clipboard.SetText(changelog);
|
||||
RadMessageBox.Show(p.Api.MainWindow, MsgBoxLangRes.ChangelogCopiedToClipboard, MsgBoxLangRes.ChangelogCopiedToClipboard_Title, MessageBoxButtons.OK, RadMessageIcon.Info);
|
||||
}
|
||||
var changelog = SharedFunctions.GenerateChangelog(p.Api.Model.CurrentWorkspace.InstallInfos, updateInfo);
|
||||
if (string.IsNullOrWhiteSpace(changelog))
|
||||
return null;
|
||||
|
||||
p.Api.MainWindow.Clipboard?.SetTextAsync(changelog);
|
||||
MessageBoxManager.GetMessageBoxStandard(MsgBoxLangRes.ChangelogCopiedToClipboard_Title, MsgBoxLangRes.ChangelogCopiedToClipboard, ButtonEnum.Ok, MsBox.Avalonia.Enums.Icon.Info).ShowAsPopupAsync(p.Api.MainWindow);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user