19 |
using System.Text; |
using System.Text; |
20 |
using RomCheater.PluginFramework.Core; |
using RomCheater.PluginFramework.Core; |
21 |
using WeifenLuo.WinFormsUI.Docking; |
using WeifenLuo.WinFormsUI.Docking; |
22 |
|
using Enterprise.Logging; |
23 |
|
|
24 |
namespace RomCheater.RVACalculator |
namespace RomCheater.RVACalculator |
25 |
{ |
{ |
26 |
public class RVACalculatorPlugin : UserControlPlugin |
public class RVACalculatorPlugin : UserControlPlugin |
27 |
{ |
{ |
28 |
|
private RVACalculatorDockControl t; |
29 |
const string name = "RVA Calculator Plugin"; |
const string name = "RVA Calculator Plugin"; |
30 |
const string description = "A simple plugin to help calculate RVA values"; |
const string description = "A simple plugin to help calculate RVA values"; |
31 |
public RVACalculatorPlugin() : base() { } |
public RVACalculatorPlugin() : base() { t = new RVACalculatorDockControl(this); } |
32 |
public override Guid ID |
public override Guid ID |
33 |
{ |
{ |
34 |
get { return AssemblyGuid.GetGuid(typeof(RVACalculatorPlugin)); } |
get { return AssemblyGuid.GetGuid(typeof(RVACalculatorPlugin)); } |
54 |
|
|
55 |
public override void Config() |
public override void Config() |
56 |
{ |
{ |
57 |
Logging.logger.Warn.WriteLine("Plugin: '{0}' guid: '{1}' - has no configurable settings", name, ID); |
gLog.Warn.WriteLine("Plugin: '{0}' guid: '{1}' - has no configurable settings", name, ID); |
58 |
} |
} |
59 |
|
|
60 |
public override void Show() { Show(null); } |
public override void Show() { Show(null); } |
62 |
public override void Show(DockPanel dockPanel, DockState dockState) { InternalShow(dockPanel, dockState); } |
public override void Show(DockPanel dockPanel, DockState dockState) { InternalShow(dockPanel, dockState); } |
63 |
private void InternalShow(DockPanel dockPanel, DockState dockState) |
private void InternalShow(DockPanel dockPanel, DockState dockState) |
64 |
{ |
{ |
65 |
#if PLUGIN_ENABLED |
#if PLUGIN_ENABLED |
|
var t = new RVACalculatorDockControl(this); |
|
66 |
if (dockPanel == null) |
if (dockPanel == null) |
67 |
{ |
{ |
68 |
t.Show(); |
t.Show(); |
75 |
Logging.logger.Warn.WriteLine("Plugin: '{0}' guid: '{1}' - is currently disabled", name, ID); |
Logging.logger.Warn.WriteLine("Plugin: '{0}' guid: '{1}' - is currently disabled", name, ID); |
76 |
#endif |
#endif |
77 |
} |
} |
78 |
|
|
79 |
|
public override void Activate() |
80 |
|
{ |
81 |
|
DockContentHandler handler = this.DockHandler; |
82 |
|
if (handler != null) |
83 |
|
handler.Activate(); |
84 |
|
} |
85 |
|
public override void Close() |
86 |
|
{ |
87 |
|
DockContentHandler handler = this.DockHandler; |
88 |
|
if (handler != null) |
89 |
|
handler.Close(); |
90 |
|
} |
91 |
|
public override DockContentHandler DockHandler |
92 |
|
{ |
93 |
|
get |
94 |
|
{ |
95 |
|
if (t == null || t.DockHandler == null) return null; |
96 |
|
return t.DockHandler; |
97 |
|
} |
98 |
|
} |
99 |
} |
} |
100 |
} |
} |