Пример #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 System.Threading.Tasks.Task InitializeAsync(System.Threading.CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            // Initialize the Fluent Migrator Menu, should only be visible for projects with FluentMigrator reference
            var mcs = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            var menuCommandId = new CommandID(FluentMigratorRunnerCommandPackageCmdSetGuidString, 0x1010);
            var menuItem      = new OleMenuCommand(null, menuCommandId);

            menuItem.BeforeQueryStatus += MenuItem_BeforeQueryStatus;

            await base.InitializeAsync(cancellationToken, progress);

            // When initialized asynchronously, we *may* be on a background thread at this point.
            // Do any initialization that requires the UI thread after switching to the UI thread.
            // Otherwise, remove the switch to the UI thread if you don't need it.
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            mcs.AddCommand(menuItem);

            MigrateUpCommand.Initialize(this);
            MigrateDownCommand.Initialize(this);
            RollbackCommand.Initialize(this);
            ListMigrationsCommand.Initialize(this);
            OptionsCommand.Initialize(this);
        }
 public static void Initialize(Package package)
 {
     Instance = new RollbackCommand(package);
 }