Profiles.ORNG.Utilities.OpenSocialManager.AddGadget C# (CSharp) Method

AddGadget() public method

public AddGadget ( int appId, string view, string optParams ) : PreparedGadget
appId int
view string
optParams string
return PreparedGadget
        public PreparedGadget AddGadget(int appId, string view, string optParams)
        {
            // this only returns enabled gadgets, and that's what we want!
            foreach (GadgetSpec spec in GetGadgetSpecifications())
            {
                if (spec.GetAppId() == appId)
                {
                    string chromeId = "gadgets-" + gadgets.Count;
                    PreparedGadget retval = new PreparedGadget(spec, this, view, optParams, chromeId);
                    gadgets.Add(retval);
                    gadgets.Sort();
                    return retval;
                }
            }
            return null;
        }

Usage Example

 public ViewPersonalGadget(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
     : base(pagedata, moduleparams, pagenamespaces)
 {
     // code to convert from numeric node ID to URI
     if (base.Namespaces.HasNamespace("rdf"))
     {
         XmlNode node = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", base.Namespaces);
         uri = node != null ? node.Value : null;
     }
     om = OpenSocialManager.GetOpenSocialManager(uri, Page);
     gadget = om.AddGadget(Convert.ToInt32(base.GetModuleParamString("AppId")), base.GetModuleParamString("View"), base.GetModuleParamString("OptParams"));
 }
All Usage Examples Of Profiles.ORNG.Utilities.OpenSocialManager::AddGadget