public async Task HelpAsync([CanBeNull, Remainder] string searchText) { searchText = searchText.Unquote(); var topLevelModules = _commands.Modules.Where(m => !m.IsSubmodule).ToList(); var moduleSearchTerms = _commands.Modules.Select ( m => new List <string>(m.Aliases) { m.Name } ) .SelectMany(t => t); var getModuleAliasResult = moduleSearchTerms.BestLevenshteinMatch(searchText, 0.5); if (getModuleAliasResult.IsSuccess) { var module = _commands.Modules.First(m => m.Aliases.Contains(getModuleAliasResult.Entity)); if (module.IsSubmodule) { module = module.GetTopLevelModule(); } var helpWizard = new HelpWizard(topLevelModules, _feedback, _help, this.Context.User); await helpWizard.OpenModule(module.Name); await _interactive.SendPrivateInteractiveMessageAndDeleteAsync ( this.Context, _feedback, helpWizard, TimeSpan.FromMinutes(30) ); return; } var commandSearchTerms = topLevelModules.SelectMany(m => m.GetAllCommands().SelectMany(c => c.Aliases)); var findCommandResult = commandSearchTerms.BestLevenshteinMatch(searchText, 0.5); if (findCommandResult.IsSuccess) { var foundAlias = findCommandResult.Entity; var commandGroup = topLevelModules .Select(m => m.GetAllCommands().Where(c => c.Aliases.Contains(findCommandResult.Entity))) .First(l => l.Any()) .Where(c => c.Aliases.Contains(foundAlias)) .GroupBy(c => c.Aliases.OrderByDescending(a => a).First()) .First(); var eb = _help.CreateDetailedCommandInfoEmbed(commandGroup); await _feedback.SendPrivateEmbedAsync(this.Context, this.Context.User, eb.Build()); } }
public void btnHelp_Click(Microsoft.Office.Core.IRibbonControl control) { var wizard = new HelpWizard() { TopMost = true, StartPosition = FormStartPosition.CenterParent }; #if DEBUG wizard.TopMost = false; #endif wizard.Show(); }
public async Task HelpAsync() { var modules = _commands.Modules.Where(m => !m.IsSubmodule).ToList(); var helpWizard = new HelpWizard(modules, _feedback, _help, this.Context.User); await _interactive.SendPrivateInteractiveMessageAndDeleteAsync ( this.Context, _feedback, helpWizard, TimeSpan.FromMinutes(30) ); }
private void btnHelp_Click(object sender, RibbonControlEventArgs e) { var wizard = new HelpWizard() { TopMost = true, StartPosition = FormStartPosition.CenterParent }; #if DEBUG wizard.TopMost = false; #endif wizard.Show(); }
private static void ShowHelp() { dynamic templateName = ((DocumentProperties)(Globals.ThisAddIn.Application.ActiveDocument.BuiltInDocumentProperties))[ WordOM.WdBuiltInProperty.wdPropertyTitle].Value.ToString(); var wizard = new HelpWizard(templateName) { TopMost = true, StartPosition = FormStartPosition.CenterParent }; #if DEBUG wizard.TopMost = false; #endif wizard.Show(); }
public void btnHelp_Click(Microsoft.Office.Core.IRibbonControl control) { var templateName = ((DocumentProperties)(Globals.ThisAddIn.Application.ActiveDocument.BuiltInDocumentProperties))[ WordOM.WdBuiltInProperty.wdPropertyTitle].Value.ToString(); var wizard = new HelpWizard(templateName) { TopMost = true, StartPosition = FormStartPosition.CenterParent }; #if DEBUG wizard.TopMost = false; #endif wizard.Show(); }
public override async Task ExecuteAsync(CommandContext context) { HelpWizard wizard = new HelpWizard(context); try { wizard.Run(); } catch { } finally { await wizard.CleanupAsync(); } }