6.1版本之前的活字格服务器基于Katana服务器,从6.1版本开始,活字格服务器从Katana迁移到ASP.NET Core,因此您需要升级单元格类型插件。
满足以下所有条件时无需升级插件:
检查项目属性,确认项目的Framework框架为.NET Framework 4.7.2。
使用Visual Studio打开.csproj文件, 在解决方案资源管理器中将Forguncy.CellTypes和Forguncy.PluginCommon移除掉。
在解决方案资源管理器中,“引用”上右击,选择添加引用。
在右下角单击“浏览”,活字格安装文件所在的bin文件夹,如果是默认安装,则路径为"C:\Program Files (x86)\Forguncy\Website\designerbin",找到以下文件,选中打开后,单击“确定”将其添加到解决方案资源管理器中。
为了确保最佳性能,请确保从Forguncy引用的所有程序集都的“复制本地”都设置为“false”。
将PluginConfig.json的“ dependencyVersion”属性更改为“ 6.0.100.0”或更高。
升级接口。
GetDrawingControl, GetEditorSetting 方法升级。
升级前 | 升级后 |
---|---|
[Icon("pack://application:,,,/BDMapCellType;component/Resources/Icon.png")] public override EditorSetting GetEditorSetting(PropertyDescriptor property, IBuilderContext builderContext) //Code....
| //此处标记了预览单元格类型的对应类。 [Designer("BDMapCellType.BDMapCellTypeDesigner, BDMapCellType")]//格式为 "Namespace.ClassName, AssemblyName" UriKind.RelativeOrAbsolute)); public override EditorSetting GetEditorSetting(PropertyDescriptor property, IBuilderContext builderContext) //Code.... } |
IDrawingHelper, ICellTypeChecker、IDependenceCells, ISupportPropertyInitialize, ISupportStyleInitialize 接口升级。
升级前 | 升级后 |
---|---|
[Icon("pack://application:,,,/BDMapCellType;component/Resources/Icon.png")] | ... class BDMapCellTypeDesigner : CellTypeDesigner<BDMapCellType>, ICellTypeChecker |
IDrawingHelper 接口升级
ICellInfo
旧属性 | 新属性 | 旧代码 | 新代码 |
---|---|---|---|
Background (System.Windows.Media.Brush) | BackgroundStr (string) | textBlock.Background = cellInfo.Background | textBlock.Background = drawingHelper.GetBrush(cellInfo.BackgroundStr); |
Foreground (System.Windows.Media.Brush) | ForegroundStr (string) | textBlock.Foreground = cellInfo.Foreground | textBlock.Foreground = drawingHelper.GetBrush(cellInfo.ForegroundStr); |
FontFamily (System.Windows.Media.FontFamily) | FontFamily (string) | textBlock.FontFamily = cellInfo.FontFamily | textBlock.FontFamily = drawingHelper.GetFontFamily(cellInfo.FontFamily); |
FontStyle(System.Windows.FontStyle) | FontStyle(string) | textBlock.FontStyle = cellInfo.FontStyle | textBlock.FontStyle = (FontStyle)new FontStyleConverter().ConvertFromString(cellInfo.FontStyle); |
FontWeight(System.Windows.FontWeight) | FontStyle(string) | textBlock.FontWeight = cellInfo.FontWeight | textBlock.FontWeight = (FontWeight)new FontWeightConverter().ConvertFromString(cellInfo.FontWeight); |
在插件名称上右击,选择“生成”或者“重新生成”。完成后重启活字格设计器,新建的插件就会安装到活字格设计器中。