예제 #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="codex">Provides subject entries for target values.</param>
        /// <param name="showLookup">Show a lookup menu.</param>
        /// <param name="monitor">Encapsulates logging and monitoring.</param>
        public SearchMenu(SubjectFactory codex, Action <ISubject> showLookup, IMonitor monitor)
        {
            // save data
            this.ShowLookup   = showLookup;
            this.Monitor      = monitor;
            this.SearchLookup = codex.GetSearchSubjects().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);
        }