OSDN Git Service

Plug-ins are started once they are all loaded
authorDouglas R. Miles <logicmoo@gmail.com>
Tue, 29 Sep 2009 23:19:40 +0000 (23:19 +0000)
committerDouglas R. Miles <logicmoo@gmail.com>
Tue, 29 Sep 2009 23:19:40 +0000 (23:19 +0000)
git-svn-id: https://radegast.googlecode.com/svn/trunk@292 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/Core/RadegastInstance.cs

index 6e20b42..f5f9280 100644 (file)
@@ -300,10 +300,26 @@ namespace Radegast
                     }\r
                     catch (Exception ex)\r
                     {\r
-                        Logger.Log("ERROR in Radegast Plugin: " + loadfilename + " because " + ex.Message + " " + ex.StackTrace, Helpers.LogLevel.Debug);\r
+                        Logger.Log("ERROR in Radegast Plugin: " + loadfilename + " because " + ex, Helpers.LogLevel.Debug);\r
                     }\r
                 }\r
             }\r
+            // run the StartPlugin\r
+            lock (PluginsLoaded)\r
+            {\r
+                foreach (IRadegastPlugin plug in PluginsLoaded)\r
+                {\r
+                    try\r
+                    {\r
+                        plug.StartPlugin(this);                    \r
+                    }\r
+                    catch (Exception ex)\r
+                    {\r
+                        Logger.Log("ERROR in Starting Radegast Plugin: " + plug + " because " + ex, Helpers.LogLevel.Debug);\r
+                    }\r
+                }\r
+            }\r
+\r
         }\r
 \r
         public void LoadAssembly(string loadfilename, Assembly assembly)\r
@@ -318,13 +334,12 @@ namespace Radegast
                         try\r
                         {\r
                             IRadegastPlugin plug = (IRadegastPlugin)ci.Invoke(new object[0]);\r
-                            plug.StartPlugin(this);\r
                             lock (PluginsLoaded) PluginsLoaded.Add(plug);\r
                             break;\r
                         }\r
                         catch (Exception ex)\r
                         {\r
-                            Logger.Log("ERROR Constructing Radegast Plugin: " + loadfilename + " because " + ex.Message, Helpers.LogLevel.Debug);\r
+                            Logger.Log("ERROR Constructing Radegast Plugin: " + loadfilename + " because " + ex, Helpers.LogLevel.Debug);\r
                             throw ex;\r
                         }\r
                     }\r