[map 3d开发实战系列] map resource explorer 之四-ag凯发k8国际
目录
[map 3d开发实战系列] map resource explorer 背景介绍--kick off
[map 3d开发实战系列] map resource explorer 之二-- 运行和调试
[map 3d开发实战系列] map resource explorer 之三-- 添加autocad风格的palette界面
如果你已经随着我们前面的文章开始创建基于wpf技术的map 3d自定义界面的话,你可能会遇到一个比较棘手的问题,就是在visual studio 2008中的wpf编辑器中,可视化界面总是显示错误,从而不能想winform界面设计一样拖控件进去。更麻烦的是两xaml编辑器的智能提示都没有了,这对我这样的wpf菜鸟来说真是要命啊!
每次在visual studio 2008中打开xaml文件,总是显示下面的错误信息:
an unhandled exception has occured.
a badimageformatexception has been thrown while parsing the signature. this is likely due to lack of a generic context. ensure generictypearguments and genericmethodarguments are provided and contain enough context.
at system.reflection.module.resolvetype(int32 metadatatoken, type[] generictypearguments, type[] genericmethodarguments)
at system.reflection.customattribute.filtercustomattributerecord(customattributerecord carecord, metadataimport scope, assembly& lastaptcaokassembly, module decoratedmodule, metadatatoken decoratedtoken, runtimetype attributefiltertype, boolean mustbeinheritable, object[] attributes, ilist derivedattributes, runtimetype& attributetype, runtimemethodhandle& ctor, boolean& ctorhasparameters, boolean& isvararg)
at system.reflection.customattribute.getcustomattributes(module decoratedmodule, int32 decoratedmetadatatoken, int32 pcacount, runtimetype attributefiltertype, boolean mustbeinheritable, ilist derivedattributes)
at system.reflection.customattribute.getcustomattributes(assembly assembly, runtimetype catype)
at system.reflection.assembly.getcustomattributes(type attributetype, boolean inherit)
at ms.internal.xaml.reflectionprojectnode.buildsubsumption()
at ms.internal.xaml.reflectionprojectnode.subsumingnamespace(identifier identifier)
at ms.internal.xaml.xmlelement.buildscope(prefixscope parentscope, iparsecontext context)
at ms.internal.xaml.xmlelement.findelementtype(prefixscope parentscope, iparsecontext context)
at ms.internal.documenttrees.markup.xamlsourcedocument.get_roottype()
at microsoft.windows.design.documents.trees.markupdocumenttreemanager.get_roottype()
at microsoft.windows.design.documents.markupdocumentmanager.calculateloaderrorstate()
at microsoft.windows.design.documents.markupdocumentmanager.get_loadstate()
at ms.internal.host.persistencesubsystem.load()
at ms.internal.host.designer.load()
at ms.internal.designer.vsdesigner.load()
at ms.internal.designer.vsisolateddesigner.vsisolatedview.load()
at ms.internal.designer.vsisolateddesigner.vsisolateddesignerfactory.load(isolatedview view)
at ms.internal.host.isolation.isolateddesigner.bootstrapproxy.loaddesigner(isolateddesignerfactory factory, isolatedview view)
at ms.internal.host.isolation.isolateddesigner.bootstrapproxy.loaddesigner(isolateddesignerfactory factory, isolatedview view)
at ms.internal.host.isolation.isolateddesigner.load()
at ms.internal.designer.designerpane.loaddesignerview()
could not load file or assembly 'acmgd, version=18.1.0.0, culture=neutral, publickeytoken=null' or one of its dependencies. an attempt was made to load a program with an incorrect format.
at system.modulehandle.resolvetype(int32 typetoken, runtimetypehandle* typeinstargs, int32 typeinstcount, runtimetypehandle* methodinstargs, int32 methodinstcount)
at system.modulehandle.resolvetypehandle(int32 typetoken, runtimetypehandle[] typeinstantiationcontext, runtimetypehandle[] methodinstantiationcontext)
at system.reflection.module.resolvetype(int32 metadatatoken, type[] generictypearguments, type[] genericmethodarguments)
这其实是map 3d 2011的一个bug。前面的文章中介绍了,我们要开发map 3d 应用程序,需要添加下列的map 3d相关引用:
map 3d相关程序集:
autodesk.map.platform.dll
autodesk.map.platform.core.dll
autodesk.map.platform.utils.dll;
autodesk.gis.map.shared.dll;
osgeo.mapguide.foundation.dll
osgeo.maoguide.platformbase.dll
但引用的上面的map 3d相关程序集,就会造成visual studio 的wpf编辑器工作不正常。当然你可以使用blend,xamlpad等其他工具来编辑xaml界面,但对于我们简单的界面设计来说,blend有点大材小用,而且学习这个软件也得花不少时间。
解决的办法就是在设计界面是,暂时把上面的map 3d相关程序集的引用移除,这样wpf界面编辑器就可以正常工作了。编辑好了界面,需要编译运行时,再重新把这些程序集的引用加进来就行了。visual studio引用对话框的recent选项卡可以快速的帮我找到最近用过的程序集,还是很方便的。
好了,先到这里,现在你可以开始设计你的基于map 3d应用程序wpf界面了。
cheers,
峻祁连
转载于:https://www.cnblogs.com/junqilian/archive/2011/02/01/1948618.html
总结
以上是ag凯发k8国际为你收集整理的[map 3d开发实战系列] map resource explorer 之四-- map3d开发中的wpf的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: javascript权威指南学习笔记一:
- 下一篇: