public int CompareWords(Word a, Word b) { int d; if (string.IsNullOrWhiteSpace(AlphabetOrder)) { d = a.Lex.CompareTo(b.Lex); if (d != 0) { return d; } } else { for (int i = 0; i < a.Lex.Length && i < b.Lex.Length; i++) { var ia = AlphabetOrder.IndexOf(char.ToLower(a.Lex[i])); var ib = AlphabetOrder.IndexOf(char.ToLower(b.Lex[i])); d = ia.CompareTo(ib); if (d != 0) { return d; } } } d = a.Lex.Length.CompareTo(b.Lex.Length); if (d != 0) { return d; } return a.Gloss.CompareTo(b.Gloss); }
public void ShowWord(Word word) { _word = null; // So we don't accidentally modify it. if (word == null) { this.definitionText.Editable = false; this.definitionText.Buffer.Clear(); this.glossEntry.Text = ""; this.glossEntry.IsEditable = false; this.lexEntry.Text = ""; this.lexEntry.IsEditable = false; } else { this.definitionText.Editable = true; this.definitionText.Buffer.Text = word.Definition; this.glossEntry.Text = word.Gloss; this.glossEntry.IsEditable = true; this.lexEntry.Text = word.Lex; this.lexEntry.IsEditable = true; _lexOnEntry = word.Lex; } _word = word; }