Created
March 12, 2017 19:29
-
-
Save Zz9uk3/b6d84a46fff42d300dc477b1f4d8e96f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel.Composition; | |
using System.Linq; | |
using System.Net.Mime; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
using ZzukBot.ExtensionFramework.Interfaces; | |
namespace TransportTester | |
{ | |
[Export(typeof(IPlugin))] | |
public class TransportTester : IPlugin | |
{ | |
private MainForm _form; | |
public TransportTester() | |
{ | |
} | |
public void Dispose() | |
{ | |
DisposeForms(); | |
} | |
private void DisposeForms() | |
{ | |
foreach (var mainForm in Application.OpenForms.OfType<MainForm>()) | |
{ | |
mainForm.Invoke((Action)(() => { mainForm.Close(); })); | |
} | |
_form?.Dispose(); | |
_form = null; | |
} | |
public string Name { get; } = "TransportTester"; | |
public string Author { get; } = "Zzuk"; | |
public int Version { get; } = 1; | |
public bool Load() | |
{ | |
return true; | |
} | |
public void Unload() | |
{ | |
Dispose(); | |
} | |
public void ShowGui() | |
{ | |
if (_form == null) _form = new MainForm(); | |
_form.ShowDialog(); | |
DisposeForms(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment