/[RomCheater]/trunk/RomCheater.RVACalculator/RVACalculatorPlugin.cs
ViewVC logotype

Diff of /trunk/RomCheater.RVACalculator/RVACalculatorPlugin.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater.RVACalculator/RVACalculatorPlugin.cs	2013/06/17 08:33:06	683
+++ trunk/RomCheater.RVACalculator/RVACalculatorPlugin.cs	2014/04/15 14:52:10	812
@@ -19,14 +19,16 @@
 using System.Text;
 using RomCheater.PluginFramework.Core;
 using WeifenLuo.WinFormsUI.Docking;
+using Enterprise.Logging;
 
 namespace RomCheater.RVACalculator
 {
     public class RVACalculatorPlugin : UserControlPlugin
     {
+        private RVACalculatorDockControl t;
         const string name = "RVA Calculator Plugin";
         const string description = "A simple plugin to help calculate RVA values";
-        public RVACalculatorPlugin() : base() { }
+        public RVACalculatorPlugin() : base() { t = new RVACalculatorDockControl(this); }
         public override Guid ID
         {
             get { return AssemblyGuid.GetGuid(typeof(RVACalculatorPlugin)); }
@@ -52,7 +54,7 @@
 
         public override void Config()
         {
-            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);
         }
 
         public override void Show() { Show(null); }
@@ -60,8 +62,7 @@
         public override void Show(DockPanel dockPanel, DockState dockState) { InternalShow(dockPanel, dockState); }
         private void InternalShow(DockPanel dockPanel, DockState dockState)
         {
-#if PLUGIN_ENABLED
-            var t = new RVACalculatorDockControl(this);
+#if PLUGIN_ENABLED            
             if (dockPanel == null)
             {
                 t.Show();
@@ -74,5 +75,26 @@
             Logging.logger.Warn.WriteLine("Plugin: '{0}' guid: '{1}' - is currently disabled", name, ID);
 #endif
         }
+
+        public override void Activate()
+        {
+            DockContentHandler handler = this.DockHandler;
+            if (handler != null)
+                handler.Activate();
+        }
+        public override void Close()
+        {
+            DockContentHandler handler = this.DockHandler;
+            if (handler != null)
+                handler.Close();
+        }
+        public override DockContentHandler DockHandler
+        {
+            get
+            {
+                if (t == null || t.DockHandler == null) return null;
+                return t.DockHandler;
+            }
+        }
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22