コード例 #1
0
        void InitializeMessageAndParameterData()
        {
            ModelItem        parameterModelItem;
            ModelTreeManager modelTreeManager = (this.ModelItem as IModelTreeItem).ModelTreeManager;

            ModelItem contentModelItem = this.ModelItem.Properties["Content"].Value;

            if (contentModelItem == null)
            {
                this.messageExpression   = modelTreeManager.WrapAsModelItem(new TMessage()).Properties["Message"].Value;
                this.declaredMessageType = null;
                parameterModelItem       = modelTreeManager.WrapAsModelItem(new TParameter()).Properties["Parameters"].Value;
            }
            else
            {
                if (contentModelItem.ItemType == typeof(TMessage))
                {
                    this.editingMode         = EditingMode.Message;
                    this.messageExpression   = contentModelItem.Properties["Message"].Value;
                    this.declaredMessageType = (Type)contentModelItem.Properties["DeclaredMessageType"].ComputedValue;
                    parameterModelItem       = modelTreeManager.WrapAsModelItem(new TParameter()).Properties["Parameters"].Value;
                }
                else
                {
                    this.editingMode         = EditingMode.Parameter;
                    this.messageExpression   = modelTreeManager.WrapAsModelItem(new TMessage()).Properties["Message"].Value;
                    this.declaredMessageType = null;
                    parameterModelItem       = contentModelItem.Properties["Parameters"].Value;
                }
            }

            bool isDictionary;
            Type underlyingArgumentType;

            this.DynamicArguments = DynamicArgumentDesigner.ModelItemToWrapperCollection(
                parameterModelItem,
                out isDictionary,
                out underlyingArgumentType);

            this.IsDictionary           = isDictionary;
            this.UnderlyingArgumentType = underlyingArgumentType;
        }