Beispiel #1
0
        // show suggestion which match the input
        private void RoomChoiceComboBoxTextBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            String text = sender.Text.ToLower();

            // a suggestion was chosen and added to the edit field
            if (suggestionChosen)
            {
                SetRoom(text);
                suggestionChosen = false;
            }
            else
            {
                SuggestedRooms.Clear();

                List <string> all = new List <string>(settingsModel.Rooms);
                foreach (String room in all)
                {
                    String lower = room.ToLower();
                    Regex  regex = new Regex(@"\b" + text);

                    if (regex.Match(lower).Success)
                    {
                        SuggestedRooms.Add(room);
                    }
                }
            }
        }
Beispiel #2
0
 private void SetRoom(String newRoom)
 {
     if (null != timetableUtils.checkRoomSpell(newRoom))
     {
         if (!timetableUtils.lookupRoom(newRoom))
         {
             SuggestedRooms.Clear();
             foreach (String room in settingsModel.Rooms)
             {
                 SuggestedRooms.Add(room);
             }
             SuggestedRooms.Add(newRoom);
             settingsModel.Rooms = new List <String>(SuggestedRooms);
         }
         SetupTimetable(newRoom);
     }
 }