Beispiel #1
0
 public IActionResult SuggestForm(SuggestionCollection appResponse)
 {     //checks to see if all the required fields are filled
     if (ModelState.IsValid)
     { //adds to the temporary storage
         TempStorage.AddSuggestion(appResponse);
         //returns the confirmation view
         return(View("Confirmation", appResponse));
     }
     else
     {   //the user stays on the suggestion form and is told what fields are not acceptable
         return(View("SuggestForm"));
     }
 }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            Dictionary<string, object> suggestDict = serializer.Deserialize<Dictionary<string, object>>(reader);

            SuggestionCollection suggestions = new SuggestionCollection();
            foreach (KeyValuePair<string, object> suggestKvp in suggestDict)
            {
                suggestions.Add(new Suggestion(
                    suggestKvp.Key,
                    JsonConvert.DeserializeObject<IEnumerable<TermSuggestion>>(suggestKvp.Value.ToString())));
            }

            return suggestions;
        }
        void CreateMenuItems(RichEditPopupMenu menu, DocumentRange range, string word)
        {
            SuggestionCollection suggestions = this.spellChecker1.GetSuggestions(word);
            int count = suggestions.Count;

            if (count > 0)
            {
                int lastIndex = Math.Min(count - 1, 5);
                for (int i = lastIndex; i >= 0; i--)
                {
                    SuggestionBase     suggestion = suggestions[i];
                    SuggestionMenuItem item       =
                        new SuggestionMenuItem(rtControl.Document, suggestion.Suggestion, range);
                    menu.Items.Insert(0, item);
                }
            }
            else
            {
                DXMenuItem emptyItem = new DXMenuItem("no spelling suggestions");
                emptyItem.Enabled = false;
                menu.Items.Insert(0, emptyItem);
            }
        }