예제 #1
0
파일: ResourceList.cs 프로젝트: mo5h/omeo
        public void Sort(string propNames, bool ascending)
        {
            Guard.NullArgument(propNames, "propNames");
            SortSettings settings = SortSettings.Parse(MyPalStorage.Storage, propNames);

            if (!ascending)
            {
                settings = settings.Reverse();
            }
            Sort(settings);
        }
예제 #2
0
        public void HandeColumnClick(ResourcePropsColumn col)
        {
            ComparableArrayList propList = new ComparableArrayList(col.PropIds);

            if (_lastComparer != null && col == _lastSortColumn)
            {
                Guard.NullMember(_curSortSettings, "_curSortSettings");
                _curSortSettings = _curSortSettings.Reverse();
                _lastSortDirections [propList] = (col.SortIcon == SortIcon.Descending);  // reverse
            }
            else
            {
                bool sortAscending = true;
                if (_lastSortDirections.ContainsKey(propList))
                {
                    sortAscending = (bool)_lastSortDirections [propList];
                }
                _curSortSettings = new SortSettings(col.PropIds, sortAscending);

                if (_lastSortColumn != null)
                {
                    _lastSortColumn.SortIcon = SortIcon.None;
                }
                _lastSortColumn = col;
            }

            _lastComparer = CreateColumnComparer(col, _curSortSettings);
            Guard.NullMember(_lastSortColumn, "_lastSortColumn");
            _lastSortColumn.SortIcon = _curSortSettings.SortAscending ? SortIcon.Ascending : SortIcon.Descending;
            Guard.NullMember(_listView, "_listView");
            _listView.NodeCollection.SetItemComparer(null, _lastComparer);
            _listView.NodeCollection.Sort();
            _listView.GroupProvider = _lastSortColumn.GroupProvider;

            OnSortChanged();
        }