Flesh out life cycle of a plugin
authorChip Black <bytex64@bytex64.net>
Mon, 8 Jun 2009 08:13:04 +0000 (03:13 -0500)
committerChip Black <bytex64@bytex64.net>
Mon, 8 Jun 2009 08:16:54 +0000 (03:16 -0500)
WebThingPlugin.cs

index 56caa4c..6ad3e9d 100644 (file)
@@ -9,13 +9,20 @@ namespace bytex64.WebThing {
         public WebThingPlugin() {
             string classname = this.GetType().FullName;
 
-            if (Config.PluginOptions.ContainsKey(classname))
+            if (Config.PluginOptions.ContainsKey(classname)) {
                 Options = Config.PluginOptions[classname];
-            else
+            } else {
                 Options = new Dictionary<string,string>();
+                Config.PluginOptions[classname] = Options;
+            }
         }
 
+        // Plugin life cycle
         public virtual void Init(WebThing wt) {}
+        public virtual void Deinit(WebThing wt) {}
+
+        // WebView life cycle
         public virtual void InitWebView(WebView wv) {}
+        public virtual void DeinitWebView(WebView wv) {}
     }
 }