///////////////////////////////////////////////////////////////////////////// // Overriden Package Implementation #region Package Members /// <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> /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param> /// <param name="progress">A provider for progress updates.</param> /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns> protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); await base.InitializeAsync(cancellationToken, progress); // When initialized asynchronously, the current thread may be a background thread at this point. // Do any initialization that requires the UI thread after switching to the UI thread. await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); // Add our command handlers for menu (commands must exist in the .vsct file) var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Transform var menuCommandId = new CommandID(GuidList.guidConfigurationTransformCmdSet, (int)PkgCmdIDList.cmdidAddConfigTransforms); var oleMenuCommand = new OleMenuCommand(MenuItemCallback, null, BeforeQueryStatus, menuCommandId); mcs.AddCommand(oleMenuCommand); // Preview var previewCommandId = new CommandID(GuidList.guidConfigurationTransformCmdSet, (int)PkgCmdIDList.cmdidPreviewConfigTransforms); var previewOleMenuCommand = new OleMenuCommand(PreviewMenuItemCallback, null, PreviewBeforeQueryStatus, previewCommandId); mcs.AddCommand(previewOleMenuCommand); // Remove RemoveCommand.Create(this, GuidList.ProjectMenuGroupCmdSet, (int)PkgCmdIDList.RemoveCommandId); } }
public static Task <int> Main(string[] args) { MSBuildLocator.RegisterDefaults(); var parser = new CommandLineBuilder() .AddCommand(AddFileCommand.Create()) .AddCommand(AddUrlCommand.Create()) .AddCommand(RefreshCommand.Create()) .AddCommand(RemoveCommand.Create()) .UseDefaults() .Build(); return(parser.InvokeAsync(args)); }
internal static Parser BuildParser(HttpClient client) { var root = new RootCommand(); root.AddCommand(AddFileCommand.Create(client)); root.AddCommand(AddUrlCommand.Create(client)); root.AddCommand(RefreshCommand.Create(client)); root.AddCommand(RemoveCommand.Create(client)); root.AddCommand(ListCommand.Create(client)); var parser = new CommandLineBuilder(root) .UseDefaults() .Build(); return(parser); }
///////////////////////////////////////////////////////////////////////////// // Overriden Package Implementation #region Package Members /// <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(); // Add our command handlers for menu (commands must exist in the .vsct file) var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Transform var menuCommandId = new CommandID(GuidList.guidConfigurationTransformCmdSet, (int)PkgCmdIDList.cmdidAddConfigTransforms); var oleMenuCommand = new OleMenuCommand(MenuItemCallback, null, BeforeQueryStatus, menuCommandId); mcs.AddCommand(oleMenuCommand); // Preview var previewCommandId = new CommandID(GuidList.guidConfigurationTransformCmdSet, (int)PkgCmdIDList.cmdidPreviewConfigTransforms); var previewOleMenuCommand = new OleMenuCommand(PreviewMenuItemCallback, null, PreviewBeforeQueryStatus, previewCommandId); mcs.AddCommand(previewOleMenuCommand); // Remove RemoveCommand.Create(this, GuidList.ProjectMenuGroupCmdSet, (int)PkgCmdIDList.RemoveCommandId); } }