Exemplo n.º 1
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 initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            // Switches to the UI thread in order to consume some services used in command initialization
            await TaskScheduler.Default;
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            // Query service asynchronously from the UI thread
            DTE = await GetServiceAsync(typeof(DTE)) as DTE2;

            ServiceFacade = new ServiceFacade(DTE);

            // Initializes the command asynchronously now on the UI thread
            await ItemContextMenuItem.InitializeAsync(this);

            await CreateWsdlMenuItem.InitializeAsync(this);

            await EditWsdlMenuItem.InitializeAsync(this);

            await CreateDataContractCodeMenuItem.InitializeAsync(this);

            await CreateWebServiceCodeMenuItem.InitializeAsync(this);

            await ImplementWsdlMenuItem.InitializeAsync(this);

            await WscfMenuItem.InitializeAsync(this);
        }
Exemplo n.º 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 initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            DTE = GetService(typeof(DTE)) as DTE2;

            ServiceFacade = new ServiceFacade(DTE);

            if (!(GetService(typeof(IMenuCommandService)) is OleMenuCommandService mcs))
            {
                return;
            }

            ItemContextMenuItem.Register(mcs);
            CreateWsdlMenuItem.Register(mcs);
            EditWsdlMenuItem.Register(mcs);
            CreateDataContractCodeMenuItem.Register(mcs);
            CreateWebServiceCodeMenuItem.Register(mcs);
            ImplementWsdlMenuItem.Register(mcs);
            WscfMenuItem.Register(mcs);
        }