public static AutoCompleteController ForProjects(List <Toggl.TogglAutocompleteView> projects) { var list = projects.Select(i => new TimerItem(i, true)).ToList <IAutoCompleteListItem>(); // categorise by workspace and client /* * var list = NoProjectItem.Create() * .Prepend(projects * .Where(p => p.ProjectID != 0) // TODO: get rid of these at an earlier stage (they are workspace entries which are not needed anymore) * .GroupBy(p => p.WorkspaceID) * .Select(ps => new WorkspaceCategory( * ps.First().WorkspaceName, * ps.GroupBy(p => p.ClientID) * .OrderBy(g => g.Key != 0) // TODO: decide how clients should be sorted * .Select(parseClientGroup) * .SelectMany(i => i).ToList() * )) * ).ToList(); */ var ac = new AutoCompleteController(list, string.Format("Projects({0})", projects.Count)); ac.autocompleteType = 3; return(ac); }
public override void CreateFrameworkElement( Panel parent, Action <AutoCompleteItem> selectWithClick, List <IRecyclable> recyclables, AutoCompleteController controller) { this.element = this.createElement(() => selectWithClick(this), recyclables); this.element.Visibility = Visibility.Visible; parent.Children.Add(this.element); }
public void SetController(AutoCompleteController controller) { this.controller = controller; this.needsToRefreshList = true; if (this.popup.IsOpen) { this.ensureList(); } }
public static AutoCompleteController ForStrings(IEnumerable <string> items) { var list = items.Select(i => new StringItem(i)).ToList <IAutoCompleteListItem>(); var ac = new AutoCompleteController(list, string.Format("Strings({0})", list.Count)); ac.autocompleteType = 1; return(ac); }
public static AutoCompleteController ForWorkspaces(List <Toggl.TogglGenericView> list) { var items = list.Select(m => new ModelItem(m)) .Cast <IAutoCompleteListItem>().ToList(); var ac = new AutoCompleteController(items, string.Format("Workspaces({0})", list.Count)); ac.autocompleteType = 2; return(ac); }
public static AutoCompleteController ForClients(List <Toggl.TogglGenericView> clients) { var list = clients.Select(m => new ModelItem(m)) .Cast <IAutoCompleteListItem>().ToList(); // categorise by workspace /* * var list = * ((IAutoCompleteListItem)new NoClientItem()).Prepend( * clients.GroupBy(c => c.WID).Select( * cs => * new WorkspaceCategory(cs.First().WorkspaceName, * cs.Select(ModelItem.Create).ToList<IAutoCompleteListItem>() * ) * ) * ).ToList(); */ var ac = new AutoCompleteController(list, string.Format("Clients({0})", clients.Count)); ac.autocompleteType = 2; return(ac); }
public void SetController(AutoCompleteController controller) { this.controller = controller; this.needsToRefreshList = true; }
/// <summary> /// instantiates a new instance of the host interface control /// </summary> public HostInterface(HostInterfaceMode mode = HostInterfaceMode.Interactive) { // initialize user control BackColor = Constants.COLOR_BACKGROUND; BorderStyle = System.Windows.Forms.BorderStyle.None; Height = 200; Width = 200; // initialize RTB RTB = new HostRtb(); RTB.Dock = DockStyle.Fill; RTB.Font = Constants.FONT_STANDARD; RTB.BackColor = Constants.COLOR_BACKGROUND; RTB.ForeColor = Constants.COLOR_STANDARD_FOREGROUND; Controls.Add(RTB); // initialize input filters InputFilters = new InputEventsFilterCollection(this); InputFilters.SetFilterMode(FilterMode.Execution); InputFilters.RegisterSubscription(HandleKeyInputResultAction); // initialize the commands collection Commands = new CommandCollection(); // initialize host writers Out = new HostWriterCollection(OnHostWriterActionHandler, GetBuffer()); // initialize prompt _writePromptAction = outWriters => { outWriters.Standard.Write("> "); }; // initialize mode Mode = mode; // initialize modules collection Modules = new ModuleCollection(Commands); Modules.Install(typeof(BitPantry.Theta.Modules.Core.Module), Out); // initialize auto complete _autoComplete = new AutoCompleteController(this); // initialize submit history _submitHistory = new List <string>(); // initialize command execution prompt _commandExecutionPrompt = new CommandExecutionPrompt(this); // initialize invoker _invoker = new CommandInvoker(this); }