Пример #1
0
        public void TestRegisterDataItem()
        {
            RootElementMaster root   = new RootElementMaster(TEST_FACTORY_KEY);
            DataScript        target = new DataScript(DataScriptBlockData.Source, null, root);

            DataContext dc = target.MyRootMaster.MasterDataContext;

            target.ConfirmDataItemsRegistered();

            Assert.IsTrue(dc.HasVariable("foo"), "Viewer key not registered with DataContext");
        }
Пример #2
0
 /// <summary>
 /// Adds a new control to the content block
 /// </summary>
 /// <param name="control"></param>
 /// <returns></returns>
 public override BaseGadgetControl AddControl(BaseGadgetControl control)
 {
     base.AddControl(control);
     if (control is DataScript)
     {
         DataScript script = (DataScript)control;
         //script.ViewNames = this.ViewNames;
         DataScripts.Add(script);
         ConfirmDataItemsRegistered();
     }
     else if (control is BaseDataControl)
     {
         AutoDataScript.AddControl(control);
         AutoDataScript.ConfirmDataItemsRegistered();
     }
     else if (control is OsTagTemplate)
     {
         MyCustomTagFactory.RegisterCustomTag((OsTagTemplate)control);
     }
     else if (control is OsTemplate && !(control is OsTagTemplate))
     {
         //Templates.Add(control.ID, (OsTemplate)control);
         Templates.Add((OsTemplate)control);
     }
     else if (control is OsVar)
     {
         //also add to templates for parsing
         Templates.Add(control);
     }
     else if (control is GadgetLiteral)
     {
         ((GadgetLiteral)control).SuppressCDATATags = true;
         Templates.Add(control);
     }
     else
     {
         //what the heck, add everything else directly for SimpleGadget support
         Templates.Add(control);
     }
     return(control);
 }