JD2022-TU1/main/tools/framework/JD.Timeline/View/Actions/OpenFromEngine.cs

42 lines
No EOL
1.3 KiB
C#

using System.Collections.Generic;
using System.Drawing;
using JD.Application.Plugin.World;
using JD.Timeline.Plugin;
using JD.UserControls.QuickOpenDialogs;
using TeaBox;
using TeaBox.Gui;
namespace JD.Timeline.View.Actions
{
class OpenFromEngine : ActionHandler
{
public override void Execute(ActionExecutionContext context)
{
base.Execute(context);
OpenTape();
}
public override bool Update(ActionContext context, ActionInfo info)
{
info.Enabled = TimelinePlugin.IsCreated();
return base.Update(context, info);
}
public static void OpenTape()
{
List<Actor> actors;
if (TimelinePlugin.Instance.GetTapeCaseActors().Join(out actors))
{
var form = new QuickOpenForm<Actor>(actors);
form.ItemAccepted += actor => TimelinePlugin.Instance.SendTapeCase(actor.Name);
form.ShowAllOnEmptyText = true;
form.Caption = "Select the TapeCase you want to open";
form.Image = Icon.FromHandle(ResourcesCached.OpenDocument.GetHicon());
form.ImageProvider = actor => Properties.ResourcesCache.Icon_20x20_tape;
form.HintProvider = actor => actor.Path;
form.Show();
}
}
}
}