private void magix_forms_controls_dynamic(object sender, ActiveEventArgs e)
        {
            Node ip = Ip(e.Params);
            if (ShouldInspect(ip))
            {
                Inspect(ip);
                return;
            }

            DynamicPanel ret = new DynamicPanel();
            FillOutParameters(e.Params, ret);

            Node node = ip["_code"].Get<Node>();

            if (node.ContainsValue("tag"))
                ret.Tag = node["tag"].Get<string>();

            if (node.ContainsValue("default"))
                ret.Default = node["default"].Get<string>();

            ret.Reload +=
                delegate(object sender2, DynamicPanel.ReloadEventArgs e2)
                {
                    DynamicPanel dynamic = sender2 as DynamicPanel;
                    Control ctrl = ModuleControllerLoader.Instance.LoadActiveModule(e2.Key);
                    if (e2.FirstReload)
                    {
                        // Since this is the Initial Loading of our module
                        // We'll need to make sure our Initial Loading procedure is being
                        // called, if Module is of type ActiveModule
                        Node nn = e2.Extra as Node;
                        ctrl.Init +=
                            delegate
                            {
                                ActiveModule module = ctrl as ActiveModule;
                                if (module != null)
                                {
                                    module.InitialLoading(nn);
                                }
                            };
                    }
                    dynamic.Controls.Add(ctrl);
                };

            ip["_ctrl"].Value = ret;
        }
Exemplo n.º 2
0
 /*
  * reloading controls upon postbacks
  */
 protected void dynamic_LoadControls(object sender, DynamicPanel.ReloadEventArgs e)
 {
     DynamicPanel dynamic = sender as DynamicPanel;
     Control ctrl = ModuleControllerLoader.Instance.LoadActiveModule(e.Key);
     if (e.FirstReload)
     {
         ActiveModule module = ctrl as ActiveModule;
         if (module != null)
         {
             Node nn = e.Extra as Node;
             ctrl.Init +=
                 delegate
                 {
                     module.InitialLoading(nn);
                 };
         }
     }
     dynamic.Controls.Add(ctrl);
 }
Exemplo n.º 3
0
        /*
         * helper for clearing controls from container, such that it gets un-registered
         */
		private void ClearControls(DynamicPanel dynamic)
        {
            foreach (Control idx in dynamic.Controls)
            {
                ActiveEvents.Instance.RemoveListener(idx);
            }
            dynamic.ClearControls();
        }