protected override async Task <bool> TryHandleCommandAsync(IProjectTree node, bool focused, Int64 commandExecuteOptions, IntPtr variantArgIn, IntPtr variantArgOut)
        {
            if (!ShouldHandle(node))
            {
                return(false);
            }

            var projectFileName = Path.GetFileName(_unconfiguredProject.FullPath);

            var projPath = await GetFileAsync(projectFileName).ConfigureAwait(false);

            await _threadingService.SwitchToUIThread();

            IVsWindowFrame frame;

            frame = _shellUtilities.OpenDocumentWithSpecificEditor(_serviceProvider, projPath, XmlEditorFactoryGuid, Guid.Empty);

            IMsBuildModelWatcher watcher = _watcherFactory.CreateExport();
            await watcher.InitializeAsync(projPath).ConfigureAwait(true);

            // When the document is closed, clean up the file on disk
            var fileCleanupListener = new EditProjectFileCleanupFrameNotifyListener(projPath, _fileSystem, watcher);

            Verify.HResult(frame.SetProperty((int)__VSFPROPID.VSFPROPID_ViewHelper, fileCleanupListener));

            // Ensure that the window is not reopened when the solution is closed
            Verify.HResult(frame.SetProperty((int)__VSFPROPID5.VSFPROPID_DontAutoOpen, true));

            // Set up a save listener, that will overwrite the project file on save.
            IVsHierarchy      unusedHier;
            uint              unusedId;
            uint              unusedCookie;
            IVsPersistDocData docData;

            _shellUtilities.GetRDTDocumentInfo(_serviceProvider, projPath, out unusedHier, out unusedId, out docData, out unusedCookie);

            var           textBuffer = _editorFactoryService.GetDocumentBuffer((IVsTextBuffer)docData);
            ITextDocument textDoc;

            if (!_textDocumentFactoryService.TryGetTextDocument(textBuffer, out textDoc))
            {
                return(false);
            }

            Assumes.NotNull(textDoc);
            textDoc.FileActionOccurred += TextDocument_FileActionOccurred;

            Verify.HResult(frame.Show());

            return(true);
        }
 public EditProjectFileCleanupFrameNotifyListener(string tempFile, IFileSystem fileSystem, IMsBuildModelWatcher watcher)
 {
     _tempFile   = tempFile;
     _fileSystem = fileSystem;
     _watcher    = watcher;
 }