コード例 #1
0
        public void Invoke(object sender, object element)
        {
            if (element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)element;
                //if (!cp.CommandArguments.ContainsKey("ControlId"))
                //    throw new ArgumentNullException("CommandParameters.ControlId @ GoogleGadgetRefresh");

                //string _cid = cp.CommandArguments["ControlId"];
                if (HttpContext.Current.Session["ControlId"] == null)
                {
                    throw new ArgumentNullException("Session.ControlId @ GoogleGadgetRefresh");
                }

                string      _cid    = HttpContext.Current.Session["ControlId"].ToString();
                string      id      = MetaViewGroupUtil.GetIdFromUniqueKey(cp.CommandArguments["primaryKeyId"]);
                HttpRequest request = HttpContext.Current.Request;

                if (request != null)
                {
                    GoogleGadgetEntity gge = (GoogleGadgetEntity)BusinessManager.Load("GoogleGadget", PrimaryKeyId.Parse(id));
                    ControlProperties.Provider.SaveValue(_cid, "PageSource", id);

                    if (gge != null)
                    {
                        ControlProperties.Provider.SaveValue(_cid, ControlProperties._titleKey, CHelper.GetResFileString(gge.Title));
                    }

                    CommandParameters cp2 = new CommandParameters("MC_GG_SelectItem");
                    Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(((CommandManager)sender).Page, cp2.ToString());
                    //((CommandManager)sender).Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "", true);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Currents the gadget.
        /// </summary>
        /// <returns></returns>
        public string CurrentGadget()
        {
            if (currentId != string.Empty)
            {
                GoogleGadgetEntity gge = (GoogleGadgetEntity)BusinessManager.Load("GoogleGadget", PrimaryKeyId.Parse(currentId));
                if (gge != null)
                {
                    return(CHelper.GetResFileString(gge.Title));
                }
            }

            return(CHelper.GetResFileString("{IbnFramework.WidgetEngine:_mc_DefaultGadget}"));
        }
コード例 #3
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(this.PageSource))
     {
         GoogleGadgetEntity gge = (GoogleGadgetEntity)BusinessManager.Load("GoogleGadget", PrimaryKeyId.Parse(this.PageSource));
         if (gge != null)
         {
             mainFrame.Attributes.Add("src", gge.Link.Replace("&", "&amp;"));
             ltEmpty.Visible   = false;
             mainFrame.Visible = true;
         }
         else
         {
             //todo: show error message
             ltEmpty.Visible   = true;
             mainFrame.Visible = false;
         }
     }
     else
     {
         ltEmpty.Visible   = true;
         mainFrame.Visible = false;
     }
 }