예제 #1
0
 /// <summary>
 /// Gets the filter text or null. This is <see cref="DsCompletion.FilterText"/> or <see cref="Completion.DisplayText"/>
 /// if <paramref name="completion"/> is not a <see cref="DsCompletion"/>
 /// </summary>
 /// <param name="completion">Completion</param>
 /// <returns></returns>
 public static string?TryGetFilterText(this Completion completion) => (completion as DsCompletion)?.FilterText ?? completion.DisplayText;
예제 #2
0
 /// <summary>
 /// GetHashCode()
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode() => (Completion?.GetHashCode() ?? 0) ^ (IsSelected ? int.MinValue : 0) ^ (IsUnique ? 0x40000000 : 0);
예제 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="completion">Completion or null</param>
 /// <param name="isSelected">true if it's selected</param>
 /// <param name="isUnique">true if it's a unique match</param>
 public CurrentCompletion(Completion completion, bool isSelected, bool isUnique)
 {
     Completion = completion;
     IsSelected = isSelected;
     IsUnique   = isUnique;
 }
예제 #4
0
 public MruSelection(Completion completion, int index)
 {
     Completion = completion;
     Index      = index;
 }
예제 #5
0
 /// <summary>
 /// Gets the MRU index of <paramref name="completion"/>
 /// </summary>
 /// <param name="completion">Completion item</param>
 /// <returns></returns>
 protected virtual int GetMruIndex(Completion completion) => int.MaxValue;
 /// <summary>
 /// Returns the index of <paramref name="item"/> in the collection or -1 if it's not present
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public int IndexOf(Completion item) => items.IndexOf(item);
 /// <summary>
 /// Checks whether <paramref name="item"/> is present in the collection
 /// </summary>
 /// <param name="item">Item</param>
 /// <returns></returns>
 public bool Contains(Completion item) => items.Contains(item);
 bool ICollection <Completion> .Remove(Completion item)
 {
     throw new NotSupportedException();
 }
 void IList <Completion> .Insert(int index, Completion item)
 {
     throw new NotSupportedException();
 }
 void ICollection <Completion> .Add(Completion item)
 {
     throw new NotSupportedException();
 }