예제 #1
0
        // dynamically create provider
        private static void CreateProvider()
        {
            ProviderList = new Dictionary <string, PromoInterface>();

            var pluginData = new PluginData(PortalSettings.Current.PortalId);
            var l          = pluginData.GetPromoProviders();

            foreach (var p in l)
            {
                var          prov   = p.Value;
                ObjectHandle handle = null;
                handle = Activator.CreateInstance(prov.GetXmlProperty("genxml/textbox/assembly"), prov.GetXmlProperty("genxml/textbox/namespaceclass"));
                var objProvider = (PromoInterface)handle.Unwrap();
                var ctrlkey     = prov.GetXmlProperty("genxml/textbox/ctrl");
                var lp          = 1;
                while (ProviderList.ContainsKey(ctrlkey))
                {
                    ctrlkey = ctrlkey + lp.ToString("");
                    lp     += 1;
                }
                objProvider.ProviderKey = ctrlkey;
                ProviderList.Add(ctrlkey, objProvider);
                if (!ProviderList.ContainsKey(ctrlkey))
                {
                    ProviderList.Add(ctrlkey, objProvider);
                }
            }
        }
예제 #2
0
        // dynamically create provider
        private static void CreateProvider()
        {
            ProviderList = new Dictionary<string, PromoInterface>();

            var pluginData = new PluginData(PortalSettings.Current.PortalId);
            var l = pluginData.GetPromoProviders();

            foreach (var p in l)
            {
                    var prov = p.Value;
                    ObjectHandle handle = null;
                    handle = Activator.CreateInstance(prov.GetXmlProperty("genxml/textbox/assembly"), prov.GetXmlProperty("genxml/textbox/namespaceclass"));
                    var objProvider = (PromoInterface)handle.Unwrap();
                    var ctrlkey = prov.GetXmlProperty("genxml/textbox/ctrl");
                    var lp = 1;
                    while (ProviderList.ContainsKey(ctrlkey))
                    {
                        ctrlkey = ctrlkey + lp.ToString("");
                        lp += 1;
                    }
                    objProvider.ProviderKey = ctrlkey;
                    ProviderList.Add(ctrlkey, objProvider);
            }
        }