mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 09:17:59 +00:00
Add DisabledActionParam to ButtonData for conditional button disabling
This commit is contained in:
2 files changed
+18
-3
No files matched your search
@@ -1,6 +1,21 @@
|
||||
namespace AIStudio.Tools;
|
||||
|
||||
public readonly record struct ButtonData(string Text, string Icon, Color Color, string Tooltip, Func<Task> AsyncAction) : IButtonData
|
||||
public readonly record struct ButtonData(string Text, string Icon, Color Color, string Tooltip, Func<Task> AsyncAction, Func<bool>? DisabledActionParam) : IButtonData
|
||||
{
|
||||
public ButtonTypes Type => ButtonTypes.BUTTON;
|
||||
|
||||
public Func<bool> DisabledAction
|
||||
{
|
||||
get
|
||||
{
|
||||
var data = this;
|
||||
return () =>
|
||||
{
|
||||
if (data.DisabledActionParam is null)
|
||||
return false;
|
||||
|
||||
return data.DisabledActionParam();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user