BBM.RemoteWidget.RemoteWidgetController.Add C# (CSharp) Method

Add() public method

public Add ( RemoteWidget w ) : void
w RemoteWidget
return void
        public void Add(RemoteWidget w)
        {
            // read parameters from Request
            w.CollectParams(m_page.Request);

            // assign an ID for the module
            string w_id = next_id.ToString();
            ++next_id;

            w.ID = w_id;

            // work out URLs that will flag a post to this module
            w.GetURL = m_postback_url_prefix;
            string post_url_prefix = m_postback_url_prefix + m_param_prefix;
            w.AjaxURL = post_url_prefix + "ajax=" + w.ParamPrefix;
            w.PostURL = post_url_prefix + "post=" + w.ParamPrefix;

            // see if the current request is a POST or AJAX call to this module
            if (m_post_target == w.ParamPrefix)
            {
                w.Method = "post";
                target = w;
            }
            else if (m_ajax_target == w.ParamPrefix)
            {
                w.Method = "ajax";
                target = w;
            }

            // and finally keep track of it so we can request it later from the srver
            m_widgets[w_id] = w;
        }

Usage Example

        protected void Page_Load(object sender, EventArgs e)
        {
            vp_user = new VpSandboxUser(Page);

            if (Request.QueryString["tagsearch"] != null)
            {
              tag = Request.QueryString["tagsearch"];
            }
            else
            {
              tag = "test"; // set a specific default tag here - this is for use in Tag-specific pages
            }

            // set up TagCloudRecentWidgetModule for recent
            m_tagsearch_recent = new RemoteWidget("TagCloudWidgetModule", "tgrc_",
              "videoplay", "tagsearch_recent");
            m_tagsearch_recent.Set("search", tag);

            // set up TagCloudWidgetModule
            m_tagsearch = new RemoteWidget("TagCloudWidgetModule", "tg_", "videoplay",
              "tagsearch");
            m_tagsearch.Set("search", tag);

              // set up widget controller and make HTTP request to backend if required (e.g. if we're handling AJAX or a form post)
            m_rwc = new RemoteWidgetController(this, ConfigurationManager.AppSettings["WidgetServerUrl"], "w_", vp_user.Language);
            if (!vp_user.anon)
            {
                m_rwc.SetUser("videoplay", vp_user.id, vp_user.login,
                    vp_user.email, vp_user.url, vp_user.first_name, vp_user.last_name, vp_user.thumbnail_url);
            }
            m_rwc.Add(m_tagsearch);
            m_rwc.Add(m_tagsearch_recent);
            m_rwc.SetupComplete();
        }
All Usage Examples Of BBM.RemoteWidget.RemoteWidgetController::Add