コード例 #1
0
        void SetupChildParameters()
        {
            if (!hiddenParameters.Any())
            {
                return;
            }

            bool foundIncomplete = false;
            int  i = 0;

            foreach (ContractParameter child in ChildParameterIterator())
            {
                ContractParameter param   = child;
                InvisibleWrapper  wrapper = null;

                // Already wrapped
                if (param.GetType() == typeof(InvisibleWrapper))
                {
                    wrapper = param as InvisibleWrapper;
                    param   = wrapper.GetParameter(0);
                }

                // Need to potentially hide
                if (foundIncomplete)
                {
                    if (hiddenParameters.Contains(param.ID) && wrapper == null)
                    {
                        wrapper = new InvisibleWrapper();
                        wrapper.AddParameter(param);
                        RemoveParameter(i);
                        paramRemoved = true;
                        AddParameter(wrapper);
                    }
                }
                // Need to potentially unhide
                else
                {
                    if (hiddenParameters.Contains(param.ID) && wrapper != null)
                    {
                        RemoveParameter(i);
                        paramRemoved = true;
                        AddParameter(param);
                    }
                }

                // Check on the state
                if (param.State != ParameterState.Complete)
                {
                    foundIncomplete = true;
                }

                i++;
            }

            if (paramRemoved)
            {
                ContractConfigurator.OnParameterChange.Fire(Root, this);
            }
        }
コード例 #2
0
        void SetupChildParameters()
        {
            if (!hiddenParameters.Any())
            {
                return;
            }

            bool foundIncomplete = false;
            int i = 0;
            foreach (ContractParameter child in ChildParameterIterator())
            {
                ContractParameter param = child;
                InvisibleWrapper wrapper = null;

                // Already wrapped
                if (param.GetType() == typeof(InvisibleWrapper))
                {
                    wrapper = param as InvisibleWrapper;
                    param = wrapper.GetParameter(0);
                }

                // Need to potentially hide
                if (foundIncomplete)
                {
                    if (hiddenParameters.Contains(param.ID) && wrapper == null)
                    {
                        wrapper = new InvisibleWrapper();
                        wrapper.AddParameter(param);
                        RemoveParameter(i);
                        paramRemoved = true;
                        AddParameter(wrapper);
                    }
                }
                // Need to potentially unhide
                else
                {
                    if (hiddenParameters.Contains(param.ID) && wrapper != null)
                    {
                        RemoveParameter(i);
                        paramRemoved = true;
                        AddParameter(param);
                    }
                }

                // Check on the state
                if (param.State != ParameterState.Complete)
                {
                    foundIncomplete = true;
                }

                i++;
            }

            if (paramRemoved)
            {
                ContractConfigurator.OnParameterChange.Fire(Root, this);
            }
        }