Use ToolFormBase as superclass in ext. tools (fixing build errors)

see 838f571e0
This commit is contained in:
YoshiRulz 2021-04-30 00:31:00 +10:00
parent 8e7f171ae9
commit 98d7e30f0d
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
4 changed files with 12 additions and 23 deletions

View File

@ -5,13 +5,14 @@ using System.Linq;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk;
using static BizHawk.Experiment.AutoGenConfig.ConfigEditorUIGenerators;
namespace BizHawk.Experiment.AutoGenConfig
{
[ExternalTool("AutoGenConfig")]
public class AutoGenConfigForm : Form, IExternalToolForm
public class AutoGenConfigForm : ToolFormBase, IExternalToolForm
{
public ApiContainer? _apiContainer { get; set; }
@ -25,7 +26,7 @@ namespace BizHawk.Experiment.AutoGenConfig
private readonly ConfigEditorMetadata Metadata = new ConfigEditorMetadata(Cache);
public override string Text => "AutoGenConfig";
protected override string WindowTitleStatic => "AutoGenConfig";
public AutoGenConfigForm()
{
@ -152,11 +153,5 @@ namespace BizHawk.Experiment.AutoGenConfig
};
ResumeLayout();
}
public bool AskSaveChanges() => true;
public void Restart() {}
public void UpdateValues(ToolFormUpdateType type) {}
}
}

View File

@ -4,14 +4,17 @@ using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Common;
using BizHawk.Client.EmuHawk;
using Community.CsharpSqlite.SQLiteClient;
namespace BizHawk.DBManTool
{
[ExternalTool("DBMan", Description = "DB Manager", LoadAssemblyFiles = new[] { "CSharp-SQLite.dll" })]
public class CustomMainForm : Form, IExternalToolForm
public class CustomMainForm : ToolFormBase, IExternalToolForm
{
protected override string WindowTitleStatic => "DBMan";
public CustomMainForm()
{
static Label CreateArgsLabel(string labelText) => new Label { Anchor = AnchorStyles.None, AutoSize = true, Text = labelText };
@ -121,10 +124,6 @@ namespace BizHawk.DBManTool
ResumeLayout();
}
public override string Text => "DBMan";
public bool AskSaveChanges() => true;
#if false
/// <remarks>This was just sitting in <c>BizHawk.Client.DBMan/Program.cs</c>.</remarks>
public static string GetExeDirectoryAbsolute()
@ -134,9 +133,5 @@ namespace BizHawk.DBManTool
return Path.GetDirectoryName(module);
}
#endif
public void Restart() {}
public void UpdateValues(ToolFormUpdateType type) {}
}
}

View File

@ -147,7 +147,6 @@
this.Controls.Add(this.label_Watch2);
this.Controls.Add(this.label_Watch1);
this.Name = "CustomMainForm";
this.Text = "HelloWorld";
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -12,7 +12,7 @@ namespace HelloWorld
[ExternalTool("HelloWorld", Description = "An example of how to interact with EmuHawk")]
// [ExternalToolApplicability.SingleRom(CoreSystem.NES, "EA343F4E445A9050D4B4FBAC2C77D0693B1D0922")] // example of limiting tool usage (this is SMB1)
[ExternalToolEmbeddedIcon("HelloWorld.icon_Hello.ico")]
public partial class CustomMainForm : Form, IExternalToolForm
public partial class CustomMainForm : ToolFormBase, IExternalToolForm
{
/// <remarks>
/// <see cref="RequiredServiceAttribute">RequiredServices</see> are populated by EmuHawk at runtime.
@ -64,6 +64,8 @@ namespace HelloWorld
}
}
protected override string WindowTitleStatic => "HelloWorld";
public CustomMainForm()
{
InitializeComponent();
@ -87,10 +89,8 @@ namespace HelloWorld
};
}
public bool AskSaveChanges() => true;
/// <remarks>This is called once when the form is opened, and every time a new movie session starts.</remarks>
public void Restart()
public override void Restart()
{
APIs.EmuClient.SetClientExtraPadding(50, 50);
@ -107,7 +107,7 @@ namespace HelloWorld
}
}
public void UpdateValues(ToolFormUpdateType type)
public override void UpdateValues(ToolFormUpdateType type)
{
if (!(type == ToolFormUpdateType.PreFrame || type == ToolFormUpdateType.FastPreFrame)
|| APIs.GameInfo.GetRomName() == "Null"