Пример #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);
            }
        }
Пример #2
0
 public void SetInitalCacheModel(CacheStoreModel model, int visibleCount, int foundCount,
                                 int mineCount, int disabledOrArchivedCount)
 {
     m_Window.CacheList.SetInitalModel(model);
     m_Window.CacheMap.SetInitalCaches(model.Caches);
     m_Window.CacheMap.UpdateChildWaypoints();
     m_Window.UpdateCounts(visibleCount, foundCount, mineCount, disabledOrArchivedCount, CacheStore.CacheCount);
 }
Пример #3
0
 public void SetInitalModel(CacheStoreModel model)
 {
     m_list = model;
     m_sort = new TreeModelSort(new TreeModelAdapter(m_list));
     cacheListTree.Model = m_sort;
     m_list.Resort(m_app.CentreLat, m_app.CentreLon);
     m_sort.SetSortFunc(3, TitleCompare);
     m_sort.SetSortFunc(2, DistanceCompare);
     m_sort.SetSortFunc(1, CodeCompare);
     m_sort.SetSortFunc(0, SymbolCompare);
     UpdateStatus();
 }