-
-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhauled saving document state. #54
Conversation
@@ -36,7 +36,10 @@ protected MenuItemBase(string name = null) | |||
|
|||
public void Add(params MenuItemBase[] menuItems) | |||
{ | |||
menuItems.Apply(Children.Add); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to fix this. It is extremely slow to create a delegate from an interface method. I changed another bit of code for the same reason.
Fixed an issue where a GeminiExport wouldn't be selected as the main export unless both its ContractName and ContractType were set. Also fixed an issue where an empty ContractName is interpreted as set, which goes against the the documentation of ExportAttribute..
I don't think adding another export attribute is a good idea. First, it definitely shouldn't inherit from export attribute, because it doesn't relate to MEF import\export in any way. Second, it's redundant since the save state code can figure out the correct exported type name itself. If someone has decorated it's class with multiple Export attributes, just choose a contract type that implements ILayoutItem. If multiple export contracts implement ILayoutItem (should never happen, actually), then throw an exception. |
…tItem instead of GeminiExports.
…tItem instead of declaring a GeminiAttribute.
@tgjones, the code looks good. Great job @Tristyn, but there's a bug. I have commented on the corresponding code lines in Tristyn@6eed10d |
I'm finally getting some time to work on Gemini. I want to pull this in - before I do, can @4ux-nbIx or @Tristyn remind me why we don't just use the type of the attributed class, instead of looking at the |
@tgjones, because we need to use MEF here and it needs the correct exported type to construct an instance. |
Ah, thanks - that makes sense. So we could avoid having to do all that if we could find an MEF equivalent to |
Well, you can still use Activator.CreateInstance if Export attribute is missing. You just need to put a corresponding flag in the state file data. |
I've merged this - thank you very much @Tristyn. (Sorry for the long delay!) |
@Tristyn, looking at Tristyn/MCFire, you seem to be one of Gemini's more active users! I notice you downgraded from the AppVeyor feed to the NuGet version - just wanted to check if there's any particular reason for that? I know there are some breaking changes, but was there something else preventing you using the trunk version? |
A while ago, I made this same pull request but it seemed impossible to get git to behave so i could resolve conflicts. Here I am again with all the conflicts resolved.
There are a few issues with saving the layout of documents and tools. Consider the following.
All of these have been fixed. In cases 2 and 3, Gemini should now save the proper type name used to create the ViewModel.
In case 4, you have to change one
[Export]
to a[GeminiExport]
:Gemini wont fail silently like it did before.
Dude, listen to this