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
Implement the hooks Restart(), LaunchGame(string) and ChangeLanguage(string).
Constructors
MainFormBase()
Initializes a new instance of the Form class.
protected MainFormBase()
Fields
Tabs
protected readonly Dictionary<Tab, ToolStripButton> Tabs
Field Value
menuFileModProperties
protected ToolStripMenuItem menuFileModProperties
Field Value
menuFilePackageMod
protected ToolStripMenuItem menuFilePackageMod
Field Value
menuLanguageEnglish
protected ToolStripMenuItem menuLanguageEnglish
Field Value
menuLanguageGerman
protected ToolStripMenuItem menuLanguageGerman
Field Value
toolStrip
protected ToolStrip toolStrip
Field Value
Properties
CurrentTab
The currently visible tab
protected Tab? CurrentTab { get; }
Property Value
Loading
Indicates the editor is currently loading something and the user must wait.
public bool Loading { get; set; }
Property Value
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
stringA two-letter ISO language code.
Dispose(bool)
Clean up any resources being used.
protected override void Dispose(bool disposing)
Parameters
disposing
booltrue 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
stringAdditional 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
stringThe type of file the tab edits (e.g. Textures, Sounds, ...).
extension
stringThe 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
stringThe 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.