/// <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 Task.WhenAll(ConvertCSToVBCommand.InitializeAsync(this),
                               ConvertVBToCSCommand.InitializeAsync(this));

            await base.InitializeAsync(cancellationToken, progress);
        }
        /// <summary>
        /// Initializes the singleton instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        public static async Task InitializeAsync(REConverterPackage package)
        {
            CodeConversion codeConversion = await CodeConversion.CreateAsync(package, package.VsWorkspace, package.GetOptionsAsync);

            OleMenuCommandService oleMenuCommandService = await package.GetServiceAsync <IMenuCommandService, OleMenuCommandService>();

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            Instance = new ConvertCSToVBCommand(package, codeConversion, oleMenuCommandService);
        }
Exemplo n.º 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 initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            var oleMenuCommandService = await this.GetServiceAsync <IMenuCommandService, OleMenuCommandService>();

            var componentModel = await this.GetServiceAsync <SComponentModel, IComponentModel>();

            await JoinableTaskFactory.SwitchToMainThreadAsync();

            var visualStudioWorkspace = componentModel.GetService <VisualStudioWorkspace>();
            var codeConversion        = await CodeConversion.CreateAsync(this, visualStudioWorkspace, this.GetDialogPageAsync <ConverterOptionsPage>);

            ConvertCSToVBCommand.Initialize(this, oleMenuCommandService, codeConversion);
            ConvertVBToCSCommand.Initialize(this, oleMenuCommandService, codeConversion);

            await TaskScheduler.Default;
            await base.InitializeAsync(cancellationToken, progress);
        }
        /// <summary>
        /// Initializes the singleton instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        public static async Task InitializeAsync(REConverterPackage package)
        {
            CodeConversion codeConversion = await CodeConversion.CreateAsync(package, package.VsWorkspace, package.GetOptionsAsync);

            Instance = new ConvertCSToVBCommand(package, codeConversion, await package.GetServiceAsync <IMenuCommandService, OleMenuCommandService>());
        }
 /// <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()
 {
     ConvertCSToVBCommand.Initialize(this);
     ConvertVBToCSCommand.Initialize(this);
     base.Initialize();
 }
 /// <remarks>
 /// Must be called from UI thread
 /// </remarks>
 public static void Initialize(REConverterPackage package, OleMenuCommandService menuCommandService, CodeConversion codeConversion)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     Instance = new ConvertCSToVBCommand(package, codeConversion, menuCommandService);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(REConverterPackage package)
 {
     Instance = new ConvertCSToVBCommand(package);
 }