示例#1
0
        /// <summary>Generates the controls on the designer panels.</summary>
        /// <param name="form">The form</param>
        /// <param name="classObject">The class objectect</param>
        /// <param name="panel1">The panel1</param>
        /// <param name="panel2">The panel to setting. Default value = null.</param>
        /// <param name="panel3">The panel3 setting. Default value = null.</param>
        /// <param name="onValueChange">The on valueue change setting. Default value = null.</param>
        /// <returns>bool</returns>
        public bool Generate_Controls(Form form, IObjectModel classObject, Panel panel1, Panel panel2 = null, Panel panel3 = null, EventHandler <onInputControl_EventArgs> onValueChange = null)
        {
            var type = classObject.GetType();
            BlueprintData_TableAttribute attribute;

            LamedalCore_.Instance.Types.Class.ClassAttributes.Find_Class(type, out attribute, new BlueprintData_TableAttribute());

            stateForm state = form.zzState();

            state.onValueChange   = onValueChange;
            state.FormObjectModel = classObject;
            state.DoEventsFlag    = false;

            IDesignerHost host   = UIDesigner_Service.IDesignerHost_FromForm(form);
            int           height = Lamedal_WinForms.Instance.libUI.WinForms.FormGenerate.Generate_Controls(host, type, attribute, panel1, panel2, panel3, OnValueChangeEvent);

            form.Height = height;
            if (attribute != null)
            {
                if (attribute.Caption != "")
                {
                    form.Text = attribute.Caption;
                }
            }

            state.DoEventsFlag = true;
            return(true);
        }
示例#2
0
        private void SyncFormAndObject(Form form)
        {
            //Update the generated the form from the object.
            stateForm state = form.zzState();

            state.DoEventsFlag = false;   // Stop events while we update things
            IObjectModel classObject = state.FormObjectModel;

            try
            {
                Lamedal_WinForms.Instance.libUI.WinForms.FormGenerate.Form_FromObject(form, classObject);
            }
            finally { state.DoEventsFlag = true; }  // Activate the events again
        }
示例#3
0
        private void OnValueChangeEvent(object sender, onInputControl_EventArgs e)
        {
            // Update the object from when the form values change
            Form      frm   = e.Control_.ParentForm;
            stateForm state = frm.zzState();

            if (state.DoEventsFlag == false)
            {
                return;                                // Events were stopped -> Exit <=========================================================
            }
            IObjectModel classObject = state.FormObjectModel;

            if (state.onValueChange != null)
            {
                state.onValueChange(sender, e);                                                  // Notify the client that the value has changed
            }
            Lamedal_WinForms.Instance.libUI.WinForms.FormGenerate.Form_ToObject(e, classObject); // Update the object in memory
            500.zExecute_Async(() => SyncFormAndObject(frm), "formRefresh", true);               // Sync the object back to the form in 1 sec
        }