Skip to content

Instantly share code, notes, and snippets.

@Zz9uk3
Created March 12, 2017 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zz9uk3/b6d84a46fff42d300dc477b1f4d8e96f to your computer and use it in GitHub Desktop.
Save Zz9uk3/b6d84a46fff42d300dc477b1f4d8e96f to your computer and use it in GitHub Desktop.
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