Example #1
0
        private async Task <IVsWindowFrame> CreateDocWindowAsync(UnconfiguredProject unconfiguredProject, string documentName, IVsHierarchy hierarchy, uint itemId)
        {
            var windowFlags = _VSRDTFLAGS.RDT_DontAddToMRU | _VSRDTFLAGS.RDT_DontAutoOpen;
            var model       = new WindowModel(project, targetUIs, lockService, threadHandler);
            await model.LoadFromProject();

            var            control    = new Control(model);
            var            windowPane = new WindowPane(control);
            var            editorType = Guid.Empty;
            var            commandUI  = Guid.Empty;
            var            caption    = $"{model.Name} Deploy Rules";
            IVsWindowFrame frame;
            var            docView = IntPtr.Zero;
            var            docData = IntPtr.Zero;
            var            hr      = 0;

            try
            {
                docView = Marshal.GetIUnknownForObject(windowPane);
                docData = Marshal.GetIUnknownForObject(model);
                hr      = uiShell.CreateDocumentWindow((uint)windowFlags, documentName, (IVsUIHierarchy)hierarchy, itemId,
                                                       docView, docData, ref editorType, null, ref commandUI, null, caption, string.Empty, null, out frame);
            }
            finally
            {
                if (docView != IntPtr.Zero)
                {
                    Marshal.Release(docView);
                }
                if (docData != IntPtr.Zero)
                {
                    Marshal.Release(docData);
                }
            }
            ErrorHandler.ThrowOnFailure(hr);
            return(frame);
        }
 internal Control(WindowModel model)
     :this()
 {
     DataContext = model;
 }
        private async Task<IVsWindowFrame> CreateDocWindowAsync(UnconfiguredProject unconfiguredProject, string documentName, IVsHierarchy hierarchy, uint itemId)
        {
            var windowFlags = _VSRDTFLAGS.RDT_DontAddToMRU | _VSRDTFLAGS.RDT_DontAutoOpen;
            var model = new WindowModel(project, targetUIs, lockService, threadHandler);
            await model.LoadFromProject();
            var control = new Control(model);
            var windowPane = new WindowPane(control);
            var editorType = Guid.Empty;
            var commandUI = Guid.Empty;
            var caption = $"{model.Name} Deploy Rules";
            IVsWindowFrame frame;
            var docView = IntPtr.Zero;
            var docData = IntPtr.Zero;
            var hr = 0;

            try
            {
                docView = Marshal.GetIUnknownForObject(windowPane);
                docData = Marshal.GetIUnknownForObject(model);
                hr = uiShell.CreateDocumentWindow((uint)windowFlags, documentName, (IVsUIHierarchy)hierarchy, itemId,
                    docView, docData, ref editorType, null, ref commandUI, null, caption, string.Empty, null, out frame);
            }
            finally
            {
                if (docView != IntPtr.Zero)
                {
                    Marshal.Release(docView);
                }
                if (docData != IntPtr.Zero)
                {
                    Marshal.Release(docData);
                }
            }
            ErrorHandler.ThrowOnFailure(hr);
            return frame;
        }
 internal Control(WindowModel model)
     : this()
 {
     DataContext = model;
 }