Exemplo n.º 1
0
        /// <summary>
        /// Update attribute value for the view.
        /// </summary>
        /// <param name="view">Updated view.</param>
        /// <param name="controls">Update controls.</param>
        /// <param name="index">Attribute index.</param>
        /// <param name="value">Updated value.</param>
        /// <returns></returns>
        private static bool UpdateProperty(IGXDLMSView view, ControlCollection controls, int index, object value)
        {
            bool found = false;

            foreach (Control it in controls)
            {
                if (it is GXValueField)
                {
                    GXValueField obj = it as GXValueField;
                    if (obj.Index == index)
                    {
                        obj.Target = view.Target;
                        obj.UpdateValueItems(view.Target, index, value);
                        obj.Value = value;
                        found     = true;
                    }
                }
                else if (it is GXButton)
                {
                    GXButton obj = it as GXButton;
                    obj.Enabled = false;
                }
                else if (it.Controls.Count != 0)
                {
                    found = UpdateProperty(view, it.Controls, index, value);
                }
                if (found)
                {
                    break;
                }
            }
            return(found);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update attribute value for the view.
        /// </summary>
        /// <param name="view">Updated view.</param>
        /// <param name="controls">Update controls.</param>
        /// <param name="index">Attribute index.</param>
        /// <param name="value">Updated value.</param>
        /// <returns></returns>
        private static GXValueField UpdateProperty(IGXDLMSView view, ControlCollection controls, int index, object value)
        {
            GXValueField item = null;

            foreach (Control it in controls)
            {
                if (it is GXValueField)
                {
                    GXValueField obj = it as GXValueField;
                    if (obj.Index == index)
                    {
                        obj.Target = view.Target;
                        obj.UpdateValueItems(view.Target, index, value);
                        obj.Value = value;
                        item      = obj;
                    }
                }
                else if (it is GXButton)
                {
                    //Do nothing.
                }
                else if (it.Controls.Count != 0)
                {
                    item = UpdateProperty(view, it.Controls, index, value);
                }
                if (item != null)
                {
                    break;
                }
            }
            return(item);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Update attribute value for the view.
        /// </summary>
        /// <param name="view">Updated view.</param>
        /// <param name="controls">Update controls.</param>
        /// <param name="index">Attribute index.</param>
        /// <param name="value">Updated value.</param>
        /// <returns></returns>
        private static GXValueField UpdateProperty(IGXDLMSView view, ControlCollection controls, int index, object value)
        {
            GXValueField item = null;

            foreach (Control it in controls)
            {
                if (it is GXValueField)
                {
                    GXValueField obj = it as GXValueField;
                    if (obj.Index == index)
                    {
                        obj.Target = view.Target;
                        obj.UpdateValueItems(view.Target, index, value);
                        if (obj.Index != 1 && view.Target.GetLastReadTime(index) == DateTime.MinValue &&
                            obj.Type != ValueFieldType.CheckedListBox)
                        {
                            obj.Value = null;
                        }
                        else
                        {
                            obj.Value = value;
                        }
                        item = obj;
                    }
                }
                else if (it is GXButton)
                {
                    //Do nothing.
                }
                else if (it.Controls.Count != 0)
                {
                    item = UpdateProperty(view, it.Controls, index, value);
                }
                if (item != null)
                {
                    break;
                }
            }
            return(item);
        }