protected virtual int Compare(Settings.SortMode sorting, Settings.IAccount a, Settings.IAccount b) { switch (sorting) { case Settings.SortMode.Account: return(stringComparer.Compare(a.WindowsAccount, b.WindowsAccount)); case Settings.SortMode.LastUsed: return(a.LastUsedUtc.CompareTo(b.LastUsedUtc)); case Settings.SortMode.Name: return(stringComparer.Compare(a.Name, b.Name)); case Settings.SortMode.CustomGrid: case Settings.SortMode.CustomList: return(a.SortKey.CompareTo(b.SortKey)); case Settings.SortMode.None: default: return(0); } }
protected virtual void OnOptionsChanged() { sorting = options.Sorting.Mode; sortingReversed = options.Sorting.Descending; grouping = options.Grouping.Mode; groupingReversed = options.Grouping.Descending; groupingEnabled = grouping != Settings.GroupMode.None && !IsSortingCustom; switch (sorting) { case Settings.SortMode.Account: case Settings.SortMode.Name: if (this.stringComparer == null) { this.stringComparer = new Util.AlphanumericStringComparer(); } break; default: this.stringComparer = null; break; } }