public override int SaveItem(VSSAVEFLAGS dwSave, string silentSaveAsName, uint itemid, IntPtr punkDocData, out int pfCancelled)
{
// Don't ignore/unignore file changes
// Use Advise/Unadvise to work around rename situations
try
{
this.StopObservingNestedProjectFile();
Debug.Assert(this.nestedHierarchy != null, "The nested hierarchy object must be created before calling this method");
Debug.Assert(punkDocData != IntPtr.Zero, "docData intptr was zero");
// Get an IPersistFileFormat object from docData object (we don't call release on punkDocData since did not increment its ref count)
IPersistFileFormat persistFileFormat = Marshal.GetTypedObjectForIUnknown(punkDocData, typeof(IPersistFileFormat)) as IPersistFileFormat;
Debug.Assert(persistFileFormat != null, "The docData object does not implement the IPersistFileFormat interface");
IVsUIShell uiShell = this.GetService(typeof(SVsUIShell)) as IVsUIShell;
string newName;
ErrorHandler.ThrowOnFailure(uiShell.SaveDocDataToFile(dwSave, persistFileFormat, silentSaveAsName, out newName, out pfCancelled));
// When supported do a rename of the nested project here
}
finally
{
// Succeeded or not we must hook to the file change events
// Don't ignore/unignore file changes
// Use Advise/Unadvise to work around rename situations
this.ObserveNestedProjectFile();
}
return VSConstants.S_OK;
}