Example #1
0
        private static void OpenDocument(string filename, out IVsTextView viewAdapter, out IVsWindowFrame pWindowFrame)
        {
            IVsTextManager textMgr = (IVsTextManager)Instance.GetService(typeof(SVsTextManager));

            IVsUIShellOpenDocument uiShellOpenDocument = Instance.GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument;
            IVsUIHierarchy         hierarchy;
            uint itemid;

            try
            {
                VsShellUtilities.OpenDocument(
                    Instance,
                    filename,
                    Guid.Empty,
                    out hierarchy,
                    out itemid,
                    out pWindowFrame,
                    out viewAdapter);
            }
            catch (Exception ex)
            {
                viewAdapter  = null;
                pWindowFrame = null;
                if (Instance != null)
                {
                    Instance.ShowDialog("Error opening file", string.Format("Error opening file {0}: \n{1}", filename, ex.Message));
                }
            }
        }
Example #2
0
        private static void OpenDocument(string filename, out IVsTextView viewAdapter, out IVsWindowFrame pWindowFrame)
        {
            IVsTextManager textMgr = (IVsTextManager)Instance.GetService(typeof(SVsTextManager));

            IVsUIShellOpenDocument uiShellOpenDocument = Instance.GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument;
            IVsUIHierarchy         hierarchy;
            uint itemid;


            VsShellUtilities.OpenDocument(
                Instance,
                filename,
                Guid.Empty,
                out hierarchy,
                out itemid,
                out pWindowFrame,
                out viewAdapter);
        }