Пример #1
0
        public void Refresh()
        {
            try
            {
                if (null != this.RefreshStart)
                {
                    RefreshStart(this, new EventArgs());
                }
                Geocache selected = SelectedCache;
                m_disabledOrArchivedCount = 0;
                m_visibleCount            = 0;
                m_mineCount  = 0;
                m_foundCount = 0;

                if (m_app.AppConfig.ImperialUnits)
                {
                    m_distanceColumn.Title = Catalog.GetString("Mi");
                    distanceLabel.Text     = Catalog.GetString("Mi");
                }
                else
                {
                    m_distanceColumn.Title = Catalog.GetString("km");
                    distanceLabel.Text     = Catalog.GetString("km");
                }

                UpdateStatus();

                CacheStore.GlobalFilters.AddFilterCriteria(FilterList.KEY_STATUS,
                                                           new bool[] { foundCheck.Active, notFoundCheck.Active, mineCheck.Active,
                                                                        availCheck.Active, notAvailCheck.Active, archiveCheck.Active });
                cacheListTree.Model = null;
                if (m_list == null)
                {
                    m_list = new CacheStoreModel();
                }
                else
                {
                    m_list.Clear();
                }


                if (m_sort == null)
                {
                    m_sort = new TreeModelSort(new TreeModelAdapter(m_list));
                    m_sort.SetSortFunc(3, TitleCompare);
                    m_sort.SetSortFunc(2, DistanceCompare);
                    m_sort.SetSortFunc(0, SymbolCompare);
                    m_sort.DefaultSortFunc = DistanceCompare;
                }
                CacheStore.ReadCache += HandleCacheStoreReadCache;
                CacheStore.Complete  += HandleCacheStoreComplete;
                CacheStore.GetUnfilteredCaches(m_app.CentreLat, m_app.CentreLon, m_app.OwnerIDs.ToArray());
                CacheStore.ReadCache -= HandleCacheStoreReadCache;
                CacheStore.Complete  -= HandleCacheStoreComplete;
            }
            catch (Exception e)
            {
                OCMApp.ShowException(e);
            }
        }