66
77using System ;
88using System . Drawing ;
9+ using System . Windows . Forms ;
910using MW5 . Plugins . Interfaces ;
1011using MW5 . UI . Properties ;
1112using Syncfusion . Windows . Forms ;
@@ -19,6 +20,7 @@ public class MapWindowForm : MetroForm
1920#endif
2021 {
2122 protected readonly IAppContext _context ;
23+ public static bool IsLoaded ;
2224
2325 public MapWindowForm ( )
2426 {
@@ -33,31 +35,38 @@ public MapWindowForm(IAppContext context)
3335 : this ( )
3436 {
3537 _context = context ;
38+ InitializeComponent ( ) ;
3639 }
3740
38- public IAppContext AppContext
39- {
40- get { return _context ; }
41- }
41+ public IAppContext AppContext => _context ;
4242
4343 private void InitializeComponent ( )
4444 {
45- this . SuspendLayout ( ) ;
45+ SuspendLayout ( ) ;
4646 //
4747 // MapWindowForm
4848 //
49- this . CaptionFont = new System . Drawing . Font ( "Microsoft Sans Serif" , 9.75F , System . Drawing . FontStyle . Regular , System . Drawing . GraphicsUnit . Point , ( ( byte ) ( 0 ) ) ) ;
50- this . ClientSize = new System . Drawing . Size ( 284 , 261 ) ;
51- this . Name = "MapWindowForm" ;
52- this . Load += new System . EventHandler ( this . MapWindowForm_Load ) ;
53- this . ResumeLayout ( false ) ;
49+ CaptionFont = new Font ( "Microsoft Sans Serif" , 9.75F , FontStyle . Regular , GraphicsUnit . Point , 0 ) ;
50+ ClientSize = new Size ( 284 , 261 ) ;
51+ Name = "MapWindowForm" ;
52+ FormClosed += MapWindowForm_FormClosed ;
53+ Load += MapWindowForm_Load ;
54+ ResumeLayout ( false ) ;
5455
5556 }
5657
5758 private void MapWindowForm_Load ( object sender , EventArgs e )
5859 {
5960 // Fixing CORE-160
6061 CaptionFont = new Font ( "Microsoft Sans Serif" , 10F , FontStyle . Regular , GraphicsUnit . Point , 0 ) ;
62+
63+ // To prevent loading multiple instances:
64+ IsLoaded = true ;
65+ }
66+
67+ private void MapWindowForm_FormClosed ( object sender , FormClosedEventArgs e )
68+ {
69+ IsLoaded = false ;
6170 }
6271 }
6372}
0 commit comments