/[RomCheater]/trunk/RomCheater.RVAScratchPad/Form1.cs
ViewVC logotype

Diff of /trunk/RomCheater.RVAScratchPad/Form1.cs

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

--- trunk/RomCheater.RVAScratchPad/Form1.cs	2013/06/18 07:24:44	709
+++ trunk/RomCheater.RVAScratchPad/Form1.cs	2013/06/18 10:59:36	716
@@ -9,12 +9,20 @@
 using RomCheater.Docking;
 using WeifenLuo.WinFormsUI.Docking;
 using System.IO;
+using RomCheater.PluginFramework.Core;
+using RomCheater.Core;
 
 namespace RomCheater.RVAScratchPad
 {
     public partial class Form1 : Form
     {
         private bool m_bSaveLayout = true;
+        PluginLoader loader = null;
+        IConfigPlugin ConfigPlugin = null;
+
+        IUserControlPlugin RVACalcPlugin = null;
+        IUserControlPlugin ScratchPadPlugin = null;
+
         private DeserializeDockContent m_deserializeDockContent;
         private FloatingLogWindow m_LogWindow = new FloatingLogWindow();
         private FloatingWebBrowser m_wb = new FloatingWebBrowser();
@@ -52,6 +60,14 @@
         private void load_plugins_silent() { load_plugins(true); }
         private void load_plugins(bool silent)
         {
+            loader = new PluginLoader();
+            loader.LoadPlugins(silent);
+            var config = PluginCollection.GetPluginByName(PluginNames.GenericConfig);
+            var scratchpad = PluginCollection.GetPluginByName(PluginNames.ScratchPadPlugin);
+            var rvacalc = PluginCollection.GetPluginByName(PluginNames.RVACalculatorPlugin);
+            ConfigPlugin = loader.GetPluginByGuid<IConfigPlugin>(config.ID.ToString());
+            ScratchPadPlugin = loader.GetPluginByGuid<IUserControlPlugin>(scratchpad.ID.ToString());
+            RVACalcPlugin = loader.GetPluginByGuid<IUserControlPlugin>(rvacalc.ID.ToString());
         }
 
 
@@ -91,26 +107,38 @@
         {
             m_LogWindow = new FloatingLogWindow();
             m_wb = new FloatingWebBrowser();
+            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
         }
         #region SetupDockWindowHandler support
         public void SetupDockWindowHandler()
         {
             SetupLogWindowHandler();
             SetupWebBrowserWindowHandler();
+            SetupPluginWindowHandlers();
+        }
+        private void SetupPluginWindowHandlers()
+        {
+            //if (RVACalcPlugin != null)
+            //{
+                
+            //}
+            //if (ScratchPadPlugin != null)
+            //{
+            //}
         }
         private void SetupLogWindowHandler()
         {
             if (m_LogWindow == null) return;
             //m_LogWindow.Shown += new EventHandler(AddDockToWindowList);
             //m_LogWindow.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
-            //m_LogWindow.Activate();
+            m_LogWindow.Activate();
         }
         private void SetupWebBrowserWindowHandler()
         {
             if (m_wb == null) return;
             //m_wb.Shown += new EventHandler(AddDockToWindowList);
             //m_wb.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
-            //m_msv.Activate();
+            m_wb.Activate();
         }
         #endregion
         public void ShowDocks()
@@ -119,6 +147,8 @@
             SetupLogWindowHandler();
             ShowWebBrowser();
             SetupWebBrowserWindowHandler();
+            ShowPluginWindows();
+            SetupPluginWindowHandlers();
         }
         public void ShowLogWindow()
         {
@@ -139,6 +169,13 @@
             m_wb.CloseButtonVisible = false;
             m_wb.Show(dockPanel);
         }
+        public void ShowPluginWindows()
+        {
+            // RVA Calc
+            RVACalcPlugin.Show(dockPanel);
+            // ScratchPad
+            ScratchPadPlugin.Show(dockPanel);
+        }
         #endregion
 
         private void Form1_FormClosing(object sender, FormClosingEventArgs e)
@@ -159,7 +196,7 @@
         {
             //dockPanel.SuspendLayout(true);
             //ShowDocks();
-            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");
+            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "RVAScratchPad-DockPanel.config");
             if (File.Exists(configFile))
             {
                 try
@@ -184,5 +221,10 @@
 
             //dockPanel.ResumeLayout(true, true);
         }
+
+        private void mnuItemExit_Click(object sender, EventArgs e)
+        {
+            this.Close();
+        }
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22