public override string[] GetCompletions(CommandCompletionContext completionContext) { var domain = this.Content.Dispatcher.Invoke(() => this.Content.Domain); var tableInfo = this.Content.Dispatcher.Invoke(() => this.Content.Table.TableInfo); return(domain.Dispatcher.Invoke(() => { var dataSet = domain.Source as CremaDataSet; var dataTable = dataSet.Tables[tableInfo.Name]; if (completionContext.Arguments.Length >= dataTable.PrimaryKey.Length) { return null; } var expItems = new List <string>(); for (var i = 0; i < completionContext.Arguments.Length; i++) { expItems.Add($"{dataTable.PrimaryKey[i].ColumnName}='{completionContext.Arguments[i]}'"); } var expression = string.Join(" AND ", expItems); var query = from item in dataTable.Select(expression) let value = CremaConvert.ChangeType(item[dataTable.PrimaryKey[completionContext.Arguments.Length]], typeof(string)) as string select value; return query.ToArray(); })); }
public override string[] GetCompletions(CommandCompletionContext completionContext) { if (completionContext.MemberDescriptor == null || completionContext.MemberDescriptor.DescriptorName == nameof(Path) == true) { return(this.CommandContext.GetCompletion(completionContext.Find)); } return(base.GetCompletions(completionContext)); }
public override string[] GetCompletions(CommandCompletionContext completionContext) { if (completionContext.MemberDescriptor is CommandMemberDescriptor memberDescriptor && memberDescriptor.DescriptorName == nameof(this.Path)) { return(this.CommandContext.GetCompletion(completionContext.Find, true)); } return(base.GetCompletions(completionContext)); }
public override string[] GetCompletions(CommandCompletionContext completionContext) { if (completionContext.MemberDescriptor != null && completionContext.MemberDescriptor.DescriptorName == nameof(this.UserID)) { return(this.GetUserList()); } return(base.GetCompletions(completionContext)); }
public override string[] GetCompletions(CommandCompletionContext completionContext) { return(this.UserContext.Dispatcher.Invoke(() => { var query = from item in this.UserContext.Users select item.ID; return query.ToArray(); })); }
public void OnCompleted(CommandCompletionContext context) { if (context.Result is IEnumerable <Stream> streams) { foreach (var stream in streams) { if (stream != null) { stream.Close(); } } } else if (context.Result is Stream stream) { stream.Close(); } }
public override string[] GetCompletions(CommandCompletionContext completionContext) { return(this.CommandContext.GetCompletion(completionContext.Find)); }