コード例 #1
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="codex">Provides subject entries for target values.</param>
        /// <param name="showLookup">Show a lookup menu.</param>
        public SearchMenu(SubjectFactory codex, Action <ISubject> showLookup)
        {
            // save data
            this.ShowLookup   = showLookup;
            this.SearchLookup = codex.GetSearchSubjects().ToLookup(p => p.Name, StringComparer.InvariantCultureIgnoreCase);

            // initialise
            this.CalculateDimensions();
            this.SearchTextbox = new SearchTextBox(Game1.smallFont, Color.Black);
            this.SearchTextbox.Select();
            this.SearchTextbox.OnChanged += (sender, text) => this.ReceiveSearchTextboxChanged(text);
        }
コード例 #2
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="searchSubjects">The subjects available to search.</param>
        /// <param name="showLookup">Show a lookup menu.</param>
        /// <param name="monitor">Encapsulates logging and monitoring.</param>
        public SearchMenu(IEnumerable <ISubject> searchSubjects, Action <ISubject> showLookup, IMonitor monitor)
        {
            // save data
            this.ShowLookup   = showLookup;
            this.Monitor      = monitor;
            this.SearchLookup = searchSubjects.ToLookup(p => p.Name, StringComparer.OrdinalIgnoreCase);

            // initialise
            this.UpdateLayout();
            this.SearchTextbox = new SearchTextBox(Game1.smallFont, Color.Black);
            this.SearchTextbox.Select();
            this.SearchTextbox.OnChanged += (sender, text) => this.ReceiveSearchTextboxChanged(text);
        }