private void putAutocomplete(List <Activity> activities, List <ProtoActivity> protoActivities) { bool changed = true; if (activities.Count == this.activitiesByButton.Count && protoActivities.Count == this.protoActivities_byButton.Count) { changed = false; foreach (Activity activity in this.activitiesByButton.Values) { if (!activities.Contains(activity)) { changed = true; break; } } foreach (ProtoActivity protoActivity in this.protoActivities_byButton.Values) { if (!protoActivities.Contains(protoActivity)) { changed = true; break; } } } if (!changed) { return; } this.activitiesByButton = new Dictionary <Button, Activity>(); this.protoActivities_byButton = new Dictionary <Button, ProtoActivity>(); for (int i = 0; i < activities.Count; i++) { Activity activity = activities[i]; this.ensureButtonLayout(i); Button button = this.buttons[i]; this.activitiesByButton[button] = activity; this.showResult(activity.ToString(), i); } for (int i = 0; i < protoActivities.Count; i++) { int y = i + activities.Count; ProtoActivity protoActivity = protoActivities[i]; this.ensureButtonLayout(y); Button button = this.buttons[y]; this.protoActivities_byButton[button] = protoActivity; this.showResult("ProtoActivity: " + protoActivity.Summarize(), y); } for (int i = activities.Count + protoActivities.Count; i < this.largeFont_autocomplete_gridLayout.NumRows; i++) { this.largeFont_autocomplete_gridLayout.PutLayout(null, 0, i); this.smallFont_autocomplete_gridLayout.PutLayout(null, 0, i); } }
private void updateButtonText() { ProtoActivity protoActivity = this.ProtoActivity; string summary = ""; if (protoActivity != null) { summary = protoActivity.Summarize(); } this.okButton.Text = summary; }
private LayoutChoice_Set summarize(ProtoActivity protoActivity) { Button button = new Button(); button.Clicked += Button_Clicked; string summary = protoActivity.Summarize(); this.protoActivities_by_button[button] = protoActivity; return(new ButtonLayout(button, summary, 16)); }