public static MainToolCommand Init(IPkg pkg, IEventLevel evt) { if (Instance != null) { return(Instance); } Instance = new MainToolCommand ( pkg, pkg.getSvc(typeof(IMenuCommandService)) as OleMenuCommandService, evt ); return(Instance); }
public static async Task <MainToolCommand> InitAsync(IPkg pkg, IEventLevel evt) { if (Instance != null) { return(Instance); } // Switch to the main thread - the call to AddCommand in MainToolCommand's constructor requires // the UI thread. await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(pkg.CancellationToken); Instance = new MainToolCommand ( pkg, await pkg.getSvcAsync(typeof(IMenuCommandService)) as OleMenuCommandService, evt ); return(Instance); }