コード例 #1
0
 public void InitializeContext()
 {
     this.settings             = new Mock <IPropertyBindingSettings>();
     this.component            = new DesignProperty(this.settings.Object);
     this.component.Attributes = new Attribute[0];
     this.component.Type       = typeof(int);
     this.descriptor           = new DesignPropertyValueDescriptor("AProperty", typeof(int), new System.ComponentModel.Int32Converter(), new Attribute[0]);
 }
コード例 #2
0
 public void Cancel()
 {
     if (DesignProperty.PropertyID > 0)
     {
         DesignProperty originalDesignProperty = ApplicationDesignService.GetDesignProperty(DesignProperty.PropertyID);
         DesignProperty = originalDesignProperty;
         DesignerViewModel.CurrentdesignProperty = originalDesignProperty;
     }
 }
コード例 #3
0
 public void InitializeContext()
 {
     this.settings = new Mock <IPropertyBindingSettings>();
     this.property = new DesignProperty(this.settings.Object)
     {
         Attributes = new Attribute[0],
         Type       = typeof(int)
     };
 }
コード例 #4
0
            public void InitializeContext()
            {
                this.settings             = new Mock <IPropertyBindingSettings>();
                this.component            = new DesignProperty(this.settings.Object);
                this.component.Attributes = new Attribute[0];
                this.component.Type       = typeof(string);

                var innerDescriptor = new Mock <PropertyDescriptor>("foo", new Attribute[0]);

                innerDescriptor.Setup(x => x.Name).Returns("Property");
                innerDescriptor.Setup(x => x.Attributes).Returns(new AttributeCollection());
                this.descriptor = new DesignPropertyValueProviderDescriptor(innerDescriptor.Object);
            }
コード例 #5
0
        public void CreateNewProperty()
        {
            InitDesignInfo();
            UIDesignInfo.State = "added";

            DesignProperty = new DesignProperty();

            DesignProperty.CollectionType = "None";
            DesignProperty.DataType       = "String";
            DesignProperty.IsNullable     = true;
            DesignProperty.SqlType        = "nvarchar";
            DesignProperty.DbFieldLength  = 50;
            DesignProperty.RelationType   = "无";
            DesignProperty.State          = "added";

            CollectionTypeEnabled            = true;
            DynTypeEnabled                   = true;
            StructEnabled                    = false;
            SqlTypeSourceEnabled             = true;
            DbFieldLengthReadOnly            = false;
            DesignProperty.IsPropertyChanged = false;
            DesignProperty.IsQueryProperty   = false;
        }
コード例 #6
0
 private static void SetSelectedItem(ITypeDescriptorContext context, ISolutionPicker picker, IUriReferenceService uriService, DesignProperty prop)
 {
     if (prop != null)
     {
         var value = prop.GetValue().ToString();
         if (!String.IsNullOrEmpty(value))
         {
             var item = uriService.TryResolveUri <IItemContainer>(new Uri(value));
             if (item != null)
             {
                 picker.SelectedItem = item;
             }
         }
     }
 }
コード例 #7
0
        public bool CreateDesignClass()
        {
            if (SelectedNameSpace == null)
            {
                MessageBox.Show("请选择命名空间!", "提示");
                return(false);
            }
            switch (MainTypeName)
            {
            case "EntityClass":
                DesignClass.MainType      = 0;
                DesignClass.MainTypeImage = ApplicationDesignCache.EntityClassImage;
                //添加主键属性
                designProperty              = new DesignProperty();
                designProperty.PropertyID   = -1;
                designProperty.PropertyName = DesignClass.ClassName + "ID";
                if (!string.IsNullOrEmpty(DesignClass.DisplayName))
                {
                    designProperty.DisplayName = DesignClass.DisplayName + "ID";
                }
                designProperty.Description    = DesignClass.DisplayName + "主键";
                designProperty.IsNullable     = false;
                designProperty.IsPersistable  = true;
                designProperty.IsPrimarykey   = true;
                designProperty.DataType       = "I32";
                designProperty.SqlType        = "int";
                designProperty.CollectionType = "None";
                designProperty.RelationType   = "无";
                designProperty.State          = "added";
                DesignClass.Properties.Add(designProperty);

                //添加名称属性
                designProperty              = new DesignProperty();
                designProperty.PropertyID   = -1;
                designProperty.PropertyName = DesignClass.ClassName + "Name";
                if (!string.IsNullOrEmpty(DesignClass.DisplayName))
                {
                    designProperty.DisplayName = DesignClass.DisplayName + "名称";
                }
                designProperty.Description    = DesignClass.DisplayName + "名称";
                designProperty.IsNullable     = true;
                designProperty.IsPersistable  = true;
                designProperty.DataType       = "String";
                designProperty.SqlType        = "nvarchar";
                designProperty.DbFieldLength  = 50;
                designProperty.CollectionType = "None";
                designProperty.RelationType   = "无";
                designProperty.State          = "added";

                DesignInfo UIDesignInfo = new DesignInfo();
                UIDesignInfo.GridColAlign   = "left";
                UIDesignInfo.GridColSorting = "str";
                UIDesignInfo.GridColType    = "ro";
                UIDesignInfo.GridWidth      = 0;
                UIDesignInfo.InputType      = "TextBox";
                UIDesignInfo.ValidateType   = "None";
                UIDesignInfo.QueryForm      = "Fuzzy";
                UIDesignInfo.ReferType      = "";
                designProperty.UIDesignInfo = UIDesignInfo;
                DesignClass.Properties.Add(designProperty);
                break;

            case "RelationClass":
                DesignClass.MainType      = 2;
                DesignClass.MainTypeImage = ApplicationDesignCache.RelationClassImage;
                //添加关联属性
                DesignClass.Properties.Add(DesignClass.RelationPropertyA);
                DesignClass.Properties.Add(DesignClass.RelationPropertyB);
                if (string.IsNullOrEmpty(DesignClass.RelationPropertyA.StructName))
                {
                    MessageBox.Show("关联属性一没有选择关联类型请检查!", "提示");
                    return(false);
                }
                if (string.IsNullOrEmpty(DesignClass.RelationPropertyB.StructName))
                {
                    MessageBox.Show("关联属性二没有选择关联类型请检查!", "提示");
                    return(false);
                }
                break;

            case "ControlClass":
                DesignClass.MainType      = 1;
                DesignClass.MainTypeImage = ApplicationDesignCache.ControlClassImage;
                DesignClass.BaseClassName = null;
                DesignClass.IsPersistable = false;
                break;

            default:
                break;
            }
            DesignClass.MainTypeName             = MainTypeName;
            DesignClass.NamespaceID              = SelectedNameSpace.NamespaceID;
            DesignClass.ModuleID                 = DesignerViewModel.SelectedTreeNode.TreeNodeID;
            DesignClass.ClassID                  = -1;
            DesignerViewModel.CurrentDesignClass = DesignClass;
            DesignerViewModel.AddNewDesignClass();
            DesignerViewModel.SaveClassCommand.RaiseCanExecuteChanged();
            return(true);
        }