Example #1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_languageInfo != null)
                {
                    _languageInfo.Dispose();
                    _languageInfo = null;
                }
            }

            base.Dispose(disposing);
        }
Example #2
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // register the editor factories
            RegisterEditorFactory(new MarkdownEditorFactoryWithoutEncoding(this));
            RegisterEditorFactory(new MarkdownEditorFactoryWithEncoding(this));

            // register the language service
            _languageInfo = new MarkdownLanguageInfo(new VsServiceProviderWrapper(this));
            ((IServiceContainer)this).AddService(typeof(MarkdownLanguageInfo), _languageInfo, true);

            // Add our command handlers for menu (commands must exist in the .vsct file)
            IMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as IMenuCommandService;

            if (mcs != null)
            {
                // Create the command for the tool window
                CommandID   toolwndCommandID = new CommandID(GuidList.guidMarkdownPackageCmdSet, PkgCmdId.cmdidMarkdownPreviewWindow);
                MenuCommand menuToolWin      = new MenuCommand(ShowToolWindow, toolwndCommandID);
                mcs.AddCommand(menuToolWin);
            }
        }
Example #3
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // register the editor factories
            RegisterEditorFactory(new MarkdownEditorFactoryWithoutEncoding(this));
            RegisterEditorFactory(new MarkdownEditorFactoryWithEncoding(this));

            // register the language service
            _languageInfo = new MarkdownLanguageInfo(new VsServiceProviderWrapper(this));
            ((IServiceContainer)this).AddService(typeof(MarkdownLanguageInfo), _languageInfo, true);

            // Add our command handlers for menu (commands must exist in the .vsct file)
            IMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as IMenuCommandService;
            if (mcs != null)
            {
                // Create the command for the tool window
                CommandID toolwndCommandID = new CommandID(GuidList.guidMarkdownPackageCmdSet, PkgCmdId.cmdidMarkdownPreviewWindow);
                MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID);
                mcs.AddCommand( menuToolWin );
            }
        }
Example #4
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_languageInfo != null)
                {
                    _languageInfo.Dispose();
                    _languageInfo = null;
                }
            }

            base.Dispose(disposing);
        }