Exemplo n.º 1
0
        private void SortSectors()
        {
            // Named sectors first
            m_sectorsListbox.CustomSortRows((a, b) =>
            {
                bool aName = string.IsNullOrEmpty(m_sectors[a.Key].SectorName);
                bool bName = string.IsNullOrEmpty(m_sectors[b.Key].SectorName);

                return(aName == bName ?
                       a.Value.ToString().CompareTo(b.Value.ToString()) :
                       (aName ? 1 : -1));
            }, 0);
        }
        private void SortSectors()
        {
            // Named sectors first
            m_mapsCombobox.CustomSortRows((a, b) =>
            {
                var sectorA = m_sectorIdentifiers[a.Key];
                var sectorB = m_sectorIdentifiers[b.Key];

                if (sectorA.UserId != sectorB.UserId)
                {
                    return(sectorA.UserId.Value.CompareTo(sectorB.UserId.Value));
                }

                bool aName = string.IsNullOrEmpty(m_sectorIdentifiers[a.Key].SectorName);
                bool bName = string.IsNullOrEmpty(m_sectorIdentifiers[b.Key].SectorName);

                return(aName == bName ?
                       a.Value.ToString().CompareTo(b.Value.ToString()) :
                       (aName ? 1 : -1));
            }, 0);
        }