示例#1
0
        protected override void OnLoad(EventArgs e)
        {
            try
            {
                base.OnLoad(e);
                if (Page.IsPostBack == false)
                {
                    #region "Check for plugins"

                    var pluginData = new PluginData(PortalId, true);
                    pluginData.UpdateSystemPlugins();
                    _systemPlugins = pluginData.GetPluginList();

                    pluginData = new PluginData(PortalId);
                    var portalPlugins = pluginData.GetPluginList();
                    Boolean upd = false;
                    foreach (var p in _systemPlugins)
                    {
                        var ctrllist = from i in portalPlugins where i.GetXmlProperty("genxml/textbox/ctrl") == p.GetXmlProperty("genxml/textbox/ctrl") select i;
                        var nBrightInfos = ctrllist as IList<NBrightInfo> ?? ctrllist.ToList();
                        if (!nBrightInfos.Any())
                        {
                            pluginData.AddPlugin(p);
                            upd = true;
                        }
                    }
                    if (upd) pluginData.Save();

                    #endregion

                    PageLoad();
                }
            }
            catch (Exception exc) //Module failed to load
            {
                //display the error on the template (don;t want to log it here, prefer to deal with errors directly.)
                var l = new Literal();
                l.Text = exc.ToString();
                phData.Controls.Add(l);
            }
        }