问题描述
我一直在这里关注本教程:msdn.microsoft.com/en-us/library/bb166195.aspx
I have been following the tutorial here: msdn.microsoft.com/en-us/library/bb166195.aspx
研究完所有内容后,我决定尝试添加Color结构作为附加属性.颜色选项正确显示在选项"面板中,如下所示:i.imgur.com/0OpMrMI.png 它们将使用指示的默认值 在代码中(此图像显示了保存之前并重新打开后发生的情况,并显示了即将描述的问题).
After going through all of it I decided to try adding a Color struct as an additional property. The color options show up correctly in the Options panel as shown here: i.imgur.com/0OpMrMI.png and they will use the default values as indicated in the code (this image shows what happens after saving before and reopening and shows the issue soon to be described).
[图像已删除]
当您修改它们然后按OK保存它们时,它们将被正确保存到注册表中,如下所示:i.imgur.com/Qi0jiwK.png(这是在我选择颜色之后输入这两个值,然后单击确定".
When you modify them and then press OK to save them they will be saved correctly into the registry as shown here: i.imgur.com/Qi0jiwK.png (This is after I selected colors for both values and then clicked OK).
[图像已删除]
如您所见,它们都已正确保存,表明SaveSettingsToStorage()函数正常运行.当使用VS2015实验实例的相同实例时,它们仍会进行设置,因为它们仍存储在内存中. 当我关闭实验实例,然后再次打开选项"面板时,就会出现问题,这些颜色将不会被加载,只有默认值(如第一个图像所示).调试后,我了解到LoadSettingsFromStorage() 函数甚至都没有尝试加载这些Color结构.
As you can see they are both saved correctly showing that the SaveSettingsToStorage() function is working properly. When using the same instance of the experimental instance of VS2015 they are still set as they are still stored in memory. The issue arises when I close the experimental instance and then open the Options panel again, the colors will not be loaded and will only have their default values (as shown in the very first image). Upon debugging I've learned that the LoadSettingsFromStorage() function is not even trying to load those Color structs.
我有一个解决方法,可以手动读取注册表,然后将其清理干净后再将颜色字符串传递给ColorConverter.这是我的颜色选项"设置. 我的未加载颜色选项"是标准的 并且应该开箱即用,但事实并非如此.
I have a workaround by manually reading the Registry and then passing the color string into the ColorConverter after cleaning it up a bit. This is the "My Color Option" setting. The "My Not-Loaded Color Option" is standard and should be working out of the box but it doesn't.
我在此处提供了完整的示例项目作为此bug的演示(请忽略我的自定义页面",因为它是教程的一部分,当前尚未保存):onedrive.live.com/redir?resid=B6E240937DB3C7A7! 604& authkey =!AIaggAIo-WvIVak& ithint = file%2c7z
I have provided the full sample project here as a demonstration of this bug (please ignore the My Custom Page as that was part of the tutorial and does not currently save): onedrive.live.com/redir?resid=B6E240937DB3C7A7!604&authkey=!AIaggAIo-WvIVak&ithint=file%2c7z
谢谢,
Kory
Thanks,
Kory
推荐答案
由于您的问题与VS扩展更相关.我将其移至Visual Studio集成论坛以获得更好的支持.
Since your quesiton is more related to the VS extension. I moved it to the Visual studio integrated forum for better support.
感谢您的理解.
最好的问候,
肖湖
这篇关于DialogPage.LoadSettingsFromStorage函数中用于颜色结构的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!