ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater.RVACalculator/RVACalculatorPlugin.cs
(Generate patch)

Comparing trunk/RomCheater.RVACalculator/RVACalculatorPlugin.cs (file contents):
Revision 659 by william, Mon Jun 17 02:21:49 2013 UTC vs.
Revision 812 by william, Tue Apr 15 14:52:10 2014 UTC

--- trunk/RomCheater.RVACalculator/RVACalculatorPlugin.cs	2013/06/17 02:21:49	659
+++ trunk/RomCheater.RVACalculator/RVACalculatorPlugin.cs	2014/04/15 14:52:10	812
@@ -19,14 +19,16 @@ using System.Linq;
 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 @@ namespace RomCheater.RVACalculator
 
         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 @@ namespace RomCheater.RVACalculator
         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();
+#if PLUGIN_ENABLED            
             if (dockPanel == null)
             {
                 t.Show();
@@ -74,5 +75,26 @@ namespace RomCheater.RVACalculator
             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;
+            }
+        }
     }
 }