Enums 更新spsolution时在sharepoint web部件中保留枚举值
我们构建了一个可视化web部件,其中枚举作为自定义属性,允许用户为按钮选择主题。主题列表按字母顺序排列 我们现在有新的主题要添加到web部件,但是如果我们只是更新主题的枚举列表,在web部件中的现有值之间添加新项目,则使用此web部件的任何人都可能会根据枚举值获得不同的主题 我已经发布了下面的代码,但我想我正在寻找关于如何最好地更新解决方案并为使用web部件的用户保留现有值的建议 现存的 公共枚举按钮项 //这些选项链接到/_layouts/images/MWHCallToAction目录例如Brown.jpg中的图像。任何新的图像选项都应添加到此处,并将实际图像上载到服务器Enums 更新spsolution时在sharepoint web部件中保留枚举值,enums,sharepoint-2010,Enums,Sharepoint 2010,我们构建了一个可视化web部件,其中枚举作为自定义属性,允许用户为按钮选择主题。主题列表按字母顺序排列 我们现在有新的主题要添加到web部件,但是如果我们只是更新主题的枚举列表,在web部件中的现有值之间添加新项目,则使用此web部件的任何人都可能会根据枚举值获得不同的主题 我已经发布了下面的代码,但我想我正在寻找关于如何最好地更新解决方案并为使用web部件的用户保留现有值的建议 现存的 公共枚举按钮项 //这些选项链接到/_layouts/images/MWHCallToAction目录例如B
{
None,
Announcement,
ApprovedSoftware,
ComputerMouse
}
New Enum could be
public enum ButtonThemes
//these choices link to images in the /_layouts/images/MWHCallToAction directory eg Brown.jpg the any new images choices should be added here and the actual images uploaded to the server.
{
None,
Announcement,
Attention,
ApprovedSoftware,
ComputerMouse,
DollarSign,
Email,
HelpDesk
}
//button theme (the type of image shown to teh left of the grey button text)
[DefaultValue(ButtonThemes.Announcement)]
[Description("Select the theme for the button.")]
[WebBrowsable(true)]
[Personalizable(PersonalizationScope.Shared)]
[Category("Button Properties")]
public ButtonThemes ButtonTheme
{
get;
set;
}
在本例中,如果有人正在使用已批准的软件主题,但我们在其前面添加了“注意”,那么当我们更新解决方案时,他们的主题可能会自动在web部件中显示为“注意”
我们可以在当前值之后添加新值,但要寻找更优雅的值
干杯
Rich修复了它
为每个枚举项及其所有属性指定一个值
None,
Announcement = 1,
ApprovedSoftware = 2,
Attention = 4,
ComputerMouse = 3
希望这有帮助