コード例 #1
0
 public override void Contextualize(IEngineContext engineContext, IControllerContext context) {
     this.me = new ControllerResourceHelper();
     me.SetController(this,context);
     me.SetContext(engineContext);
     base.Contextualize(engineContext, context);
     if(ViewRoot.hasContent()) {
         this.SelectedViewName = this.SelectedViewName.ToLower().Replace(this.Name + "\\", ViewRoot);
     }
     PropertyBag["me"] = me;
     PropertyBag["mycss"] = me.getCss();
     PropertyBag["myjs"] = me.getJs();
     PropertyBag["myname"] = context.Name.ToLower();
     if(this.Params["ajax"].noContent()) {
         try {
             PropertyBag["widgets"] = myapp.widgets.GetMyWidgets();
         }catch(Exception ex) {
             
         }
     }
 }
コード例 #2
0
        public override void Contextualize(IEngineContext engineContext, IControllerContext context)
        {
            this.me = new ControllerResourceHelper();
            me.SetController(this, context);
            me.SetContext(engineContext);

            base.Contextualize(engineContext, context);
            PropertyBag["mydb"] = Db;
            PropertyBag["myfiles"] = Resolver;
            PropertyBag["usrdata"] = myapp.getProfile();

            var roots = PkgAttribute.Get(context).ToList();
            var mainroot = new[]{context.AreaName.hasContent() ? context.AreaName : null, context.Name}.concat(".")+".controller";
            if (mainroot.StartsWith(".")) mainroot = mainroot.Substring(1);
            roots.Insert(0,mainroot);
            if (roots.yes()){
                PropertyBag["webpackages"] = roots;
            }

            foreach (var parameter in GetPrefixedParameters("param")){
                PropertyBag[parameter.Key] = parameter.Value;
            }

            PropertyBag["me"] = me;
            PropertyBag["mycss"] = me.getCss();
            PropertyBag["myjs"] = me.getJs();
            PropertyBag["myname"] = context.Name.ToLower();
            if (this.Params["ajax"].noContent())
            {
                try
                {
                    PropertyBag["widgets"] = myapp.widgets.GetMyWidgets();
                }
                catch (Exception ex)
                {

                }
            }
        }