Table of Contents

Class MainFormBase

Namespace
AlphaFramework.Editor
Assembly
AlphaFramework.Editor.dll

An extendable basis for an editor main window.

public class MainFormBase : Form, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl, IToastProvider
Inheritance
MainFormBase
Implements
Derived
Inherited Members
Extension Methods

Remarks

Constructors

MainFormBase()

Initializes a new instance of the Form class.

protected MainFormBase()

Fields

Tabs

protected readonly Dictionary<Tab, ToolStripButton> Tabs

Field Value

Dictionary<Tab, ToolStripButton>

menuFileModProperties

protected ToolStripMenuItem menuFileModProperties

Field Value

ToolStripMenuItem

menuFilePackageMod

protected ToolStripMenuItem menuFilePackageMod

Field Value

ToolStripMenuItem

menuLanguageEnglish

protected ToolStripMenuItem menuLanguageEnglish

Field Value

ToolStripMenuItem

menuLanguageGerman

protected ToolStripMenuItem menuLanguageGerman

Field Value

ToolStripMenuItem

toolStrip

protected ToolStrip toolStrip

Field Value

ToolStrip

Properties

CurrentTab

The currently visible tab

protected Tab? CurrentTab { get; }

Property Value

Tab

Loading

Indicates the editor is currently loading something and the user must wait.

public bool Loading { get; set; }

Property Value

bool

Methods

AddTab(Tab)

protected void AddTab(Tab tab)

Parameters

tab Tab

ChangeLanguage(string)

Applies a new language to the editor GUI, game logic, etc..

protected virtual void ChangeLanguage(string language)

Parameters

language string

A two-letter ISO language code.

Dispose(bool)

Clean up any resources being used.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true if managed resources should be disposed; otherwise, false.

LaunchGame(string)

Launches the main game with the currently active mod.

protected virtual void LaunchGame(string arguments)

Parameters

arguments string

Additional arguments to be passed; may be null.

Exceptions

Win32Exception

The game executable could not be launched.

BadImageFormatException

The game executable is damaged.

OpenFileTab<T>(string, string, Func<string, bool, T>)

Displays a file-editing tab.

protected void OpenFileTab<T>(string type, string extension, Func<string, bool, T> getInstance) where T : Tab

Parameters

type string

The type of file the tab edits (e.g. Textures, Sounds, ...).

extension string

The file extension of the file type with a dot, but without an asterisk (e.g. .xml, .png, ...).

getInstance Func<string, bool, T>

A callback for creating an instance of the tab.

Type Parameters

T

The tab type to display.

Restart()

Restarts the editor to allow the user to choose a different mod.

protected virtual void Restart()

ShowSingleInstanceTab<T>()

Displays a single-instance tab.

protected void ShowSingleInstanceTab<T>() where T : Tab, new()

Type Parameters

T

The tab type to display.

ShowTab(Tab)

protected void ShowTab(Tab tab)

Parameters

tab Tab

ShowToast(string)

Displays a new toast messages to the user. Any exisiting messages are replaced.

public void ShowToast(string message)

Parameters

message string

The message text to be displayed.

Remarks

A toast message is a message that pops up from a corner of the screen or window and vanishes after a few seconds without the user needing to confirm it.