コード例 #1
0
        /// <summary>
        /// This will be called when a Formular is changed in the registry, to make all affected nodes comply with potential re-configuration
        /// </summary>
        /// <param name="sender">Usually Context</param>
        /// <param name="e">Contains the new Formular</param>
        protected virtual void FormularRemotelyChanged(MessageFormularRegistry sender, MessageFormular formular)
        {
            if (FFormularSelection.IsAnyInvalid())
            {
                return;                                     // before and during first frame input pins might not be valid yet
            }
            if (formular.IsDynamic)
            {
                return;
            }

            if (FFormularSelection[0] == formular.Name)
            {
                formular = formular.Clone() as MessageFormular; // keep a copy

                if (CustomizeFormular)
                {
                    formular.Require(RequireEnum.NoneBut, Formular); // never automatically add anything. e.g never add pins without user consent
                }
                else
                {
                    formular.Require(RequireEnum.All);  // always add all.
                }
                Formular = formular;
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="newFormular"></param>
        /// <param name="append"></param>
        ///
        private void UpdateWindow(MessageFormular newFormular, bool append = false)
        {
            if (newFormular == null)
            {
                return;
            }

            var old = LayoutPanel.Formular;                       // retrieve copy

            newFormular = newFormular.Clone() as MessageFormular; // act on copy

            if (append)
            {
                // overwrite all existing fields, and hand back the result
                foreach (var field in newFormular.FieldDescriptors)
                {
                    old[field.Name] = field; // hard overwrite
                }
                old.Require(RequireEnum.NoneButBoth, newFormular);
                old.Name    = newFormular.Name;
                newFormular = old;
            }
            else
            {
                newFormular.Require(RequireEnum.NoneButBoth, old);
            }

            LayoutPanel.Changed -= ReadLayoutPanel;
            LayoutPanel.Formular = newFormular;
            LayoutPanel.Changed += ReadLayoutPanel;

            LayoutPanel.CanEditFields = newFormular.IsDynamic;
        }
コード例 #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="newFormular"></param>
        /// <param name="append"></param>
        /// 
        private void UpdateWindow(MessageFormular newFormular, bool append = false)
        {
            if (newFormular == null) return;

            var old = LayoutPanel.Formular; // retrieve copy
            newFormular = newFormular.Clone() as MessageFormular; // act on copy

            if (append)
            {
                // overwrite all existing fields, and hand back the result
                foreach (var field in newFormular.FieldDescriptors)
                {
                    old[field.Name] = field; // hard overwrite
                }
                old.Require(RequireEnum.NoneButBoth, newFormular);
                old.Name = newFormular.Name;
                newFormular = old;
            }
            else
            {
                newFormular.Require(RequireEnum.NoneButBoth, old);
            }

            LayoutPanel.Changed -= ReadLayoutPanel;
            LayoutPanel.Formular = newFormular;
            LayoutPanel.Changed += ReadLayoutPanel;

            LayoutPanel.CanEditFields = newFormular.IsDynamic;
        }
コード例 #4
0
        /// <summary>
        /// This will be called when a Formular is changed in the registry, to make all affected nodes comply with potential re-configuration
        /// </summary>
        /// <param name="sender">Usually Context</param>
        /// <param name="e">Contains the new Formular</param>
        protected virtual void FormularRemotelyChanged(MessageFormularRegistry sender, MessageFormular formular)
        {
            if (FFormularSelection.IsAnyInvalid()) return;  // before and during first frame input pins might not be valid yet
            if (formular.IsDynamic) return;

            if (FFormularSelection[0] == formular.Name)
            {
                formular = formular.Clone() as MessageFormular; // keep a copy

                if (CustomizeFormular)
                    formular.Require(RequireEnum.NoneBut, Formular); // never automatically add anything. e.g never add pins without user consent
                else formular.Require(RequireEnum.All); // always add all.

                Formular = formular;
            }
        }