当前位置: 首页>>代码示例>>C#>>正文


C# Utils.ProgressBlock.UpdateProgress方法代码示例

本文整理汇总了C#中Utils.ProgressBlock.UpdateProgress方法的典型用法代码示例。如果您正苦于以下问题:C# Utils.ProgressBlock.UpdateProgress方法的具体用法?C# Utils.ProgressBlock.UpdateProgress怎么用?C# Utils.ProgressBlock.UpdateProgress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utils.ProgressBlock的用法示例。


在下文中一共展示了Utils.ProgressBlock.UpdateProgress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ImportMethod

        protected override void ImportMethod()
        {
            using (Utils.ProgressBlock blockprogress = new Utils.ProgressBlock(this, STR_IMPORTINGCACHES, STR_IMPORTINGCACHES, 1, 0))
            {
                try
                {
                    //first get a list of geocache codes
                    List<string> gcList = OKAPIService.GetGeocachesWithinRadius(SiteManager.Instance.ActiveSite, _centerLoc, _radiusKm, _filter);
                    using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_IMPORTINGCACHES, STR_IMPORTINGCACHES, gcList.Count, 0, true))
                    {
                        int gcupdatecount = 1;
                        int max = gcList.Count;
                        while (gcList.Count > 0)
                        {
                            List<string> lcs = gcList.Take(gcupdatecount).ToList();
                            gcList.RemoveRange(0, lcs.Count);
                            List<OKAPIService.Geocache> caches = OKAPIService.GetGeocaches(SiteManager.Instance.ActiveSite, lcs);
                            Import.AddGeocaches(Core, caches);

                            if (!progress.UpdateProgress(STR_IMPORTINGCACHES, STR_IMPORTINGCACHES, max, max - gcList.Count))
                            {
                                break;
                            }
                        }

                    }
                }
                catch (Exception e)
                {
                    _errormessage = e.Message;
                }
            }
        }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:33,代码来源:ImportByRadius.cs

示例2: ImportMethod

        protected override void ImportMethod()
        {
            int max = _gcList.Count; //caches, waypoints, logs
            int index = 0;
            DateTime nextUpdate = DateTime.Now.AddSeconds(1);
            using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_ASSIGNCITY, STR_ASSIGNCITY, max, 0, true))
            {
                foreach (Framework.Data.Geocache gc in _gcList)
                {
                    if (index>0)
                    {
                        System.Threading.Thread.Sleep(1000); //OSM policy
                    }
                    gc.City = Utils.Geocoder.GetCityName(gc.Lat, gc.Lon);

                    index++;
                    if (DateTime.Now >= nextUpdate)
                    {
                        if (!progress.UpdateProgress(STR_ASSIGNCITY, STR_ASSIGNCITY, max, index))
                        {
                            break;
                        }
                    }
                }
            }
        }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:26,代码来源:AssignCity.cs

示例3: ImportMethod

        protected override void ImportMethod()
        {
            //for now, we just use the active site
            //howver, in the future it is better to automatically switcg according geocode prefix
            //at this moment, the user is responsible for selecting the geocaches and the active site
            try
            {
                //first get a list of geocache codes
                using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_UPDATINGGEOCACHES, STR_UPDATINGGEOCACHES, _gcList.Count, 0, true))
                {
                    int gcupdatecount = 1;
                    int max = _gcList.Count;
                    while (_gcList.Count > 0)
                    {
                        List<string> lcs = (from Framework.Data.Geocache g in _gcList select g.Code).Take(gcupdatecount).ToList();
                        _gcList.RemoveRange(0, lcs.Count);
                        List<OKAPIService.Geocache> caches = OKAPIService.GetGeocaches(SiteManager.Instance.ActiveSite, lcs);
                        Import.AddGeocaches(Core, caches);

                        if (!progress.UpdateProgress(STR_UPDATINGGEOCACHES, STR_UPDATINGGEOCACHES, max, max - _gcList.Count))
                        {
                            break;
                        }
                    }

                }
            }
            catch (Exception e)
            {
                _errormessage = e.Message;
            }
        }
开发者ID:RH-Code,项目名称:GAPP,代码行数:32,代码来源:Updater.cs

示例4: ImportMethod

        protected override void ImportMethod()
        {
            try
            {
                using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_IMPORTINGCACHES, STR_IMPORTINGCACHES, _gcList.Count, 0, true))
                {
                    int gcupdatecount = 1;
                    int max = _gcList.Count;
                    while (_gcList.Count > 0)
                    {
                        List<string> lcs = _gcList.Take(gcupdatecount).ToList();
                        _gcList.RemoveRange(0, lcs.Count);
                        List<OKAPIService.Geocache> caches = OKAPIService.GetGeocaches(SiteManager.Instance.ActiveSite, lcs);
                        Import.AddGeocaches(Core, caches);

                        if (!progress.UpdateProgress(STR_IMPORTINGCACHES, STR_IMPORTINGCACHES, max, max - _gcList.Count))
                        {
                            break;
                        }
                    }

                }
            }
            catch (Exception e)
            {
                _errormessage = e.Message;
            }
        }
开发者ID:RH-Code,项目名称:GAPP,代码行数:28,代码来源:ImportByGCCodes.cs

示例5: searchInDescriptionThreadMethod

 private void searchInDescriptionThreadMethod()
 {
     using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_ACTIONTITLE, STR_ACTIONTEXT, _gcSearchList.Count, 0, true))
     {
         try
         {
             int block = 0;
             int index = 0;
             foreach (Framework.Data.Geocache wp in _gcSearchList)
             {
                 wp.Selected = (wp.ShortDescription.IndexOf(_txt, _scType) >= 0 || wp.LongDescription.IndexOf(_txt, _scType) >= 0);
                 block++;
                 index++;
                 if (block > 1000)
                 {
                     block = 0;
                     if (!progress.UpdateProgress(STR_ACTIONTITLE, STR_ACTIONTEXT, _gcSearchList.Count, index))
                     {
                         break;
                     }
                 }
             }
         }
         catch
         {
         }
         //signal finished
     }
     _actionReady.Set();
 }
开发者ID:RH-Code,项目名称:GAPP,代码行数:30,代码来源:GeocacheTextSearch.cs

示例6: ImportMethod

 protected override void ImportMethod()
 {
     using (Utils.ProgressBlock fixpr = new Utils.ProgressBlock(this, STR_IMPORTING, STR_IMPORTINGDATA, _filenames.Length, 0))
     {
         for (int fileindex = 0; fileindex < _filenames.Length; fileindex++)
         {
             List<Framework.Data.Geocache> res = ProcessWaymarkComGPXFile(_filenames[fileindex]);
             if (res != null && res.Count > 0)
             {
                 using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_IMPORTING, STR_IMPORTINGGEOCACHES, res.Count, 0))
                 {
                     int index = 0;
                     int procStep = 0;
                     foreach (Framework.Data.Geocache gc in res)
                     {
                         AddGeocache(gc, Framework.Data.Geocache.V1);
                         index++;
                         procStep++;
                         if (procStep >= 100)
                         {
                             progress.UpdateProgress(STR_IMPORTING, STR_IMPORTINGGEOCACHES, res.Count, index);
                             procStep = 0;
                         }
                     }
                 }
             }
             fixpr.UpdateProgress(STR_IMPORTING, STR_IMPORTINGDATA, _filenames.Length, fileindex + 1);
         }
     }
 }
开发者ID:RH-Code,项目名称:GAPP,代码行数:30,代码来源:GpxImport.cs

示例7: Action

        public override bool Action(string action)
        {
            bool result = base.Action(action);
            if (result && action == ACTION_SHOW)
            {
                try
                {
                    var logs = new List<Utils.API.LiveV6.GeocacheLog>();

                    using (var api = new Utils.API.GeocachingLiveV6(Core))
                    {
                        using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, "Importing logs", "Importing logs...", 100, 0, true))
                        {
                            var req = new Utils.API.LiveV6.GetUsersGeocacheLogsRequest();
                            req.AccessToken = api.Token;
                            req.Username = "SKAMS";
                            req.ExcludeArchived = true;
                            req.MaxPerPage = 100;
                            req.StartIndex = 0;
                            req.LogTypes = (from a in Core.LogTypes where a.AsFound select (long)a.ID).ToArray();
                            var resp = api.Client.GetUsersGeocacheLogs(req);
                            while (resp.Status.StatusCode == 0)
                            {
                                logs.AddRange(resp.Logs);

                                if (resp.Logs.Count() >= req.MaxPerPage)
                                {
                                    req.StartIndex = logs.Count;
                                    if (!progress.UpdateProgress("Importing logs", "Importing logs...", logs.Count + req.MaxPerPage, logs.Count))
                                    {
                                        break;
                                    }
                                    resp = api.Client.GetUsersGeocacheLogs(req);
                                }
                                else
                                {
                                    break;
                                }
                            }
                            if (resp.Status.StatusCode != 0)
                            {
                                //_errormessage = resp.Status.StatusMessage;
                            }
                        }
                    }
                }
                catch
                {
                }
            }
            return result;
        }
开发者ID:RH-Code,项目名称:GAPP,代码行数:52,代码来源:GetOtherUserLogs.cs

示例8: getCopiedSelectionGeocacheInbackgroundMethod

 private void getCopiedSelectionGeocacheInbackgroundMethod()
 {
     try
     {
         int max = _importGeocaches.Count;
         using (Utils.ProgressBlock prog = new Utils.ProgressBlock(OwnerPlugin as Utils.BasePlugin.Plugin, STR_COPYSELECTION, STR_RETRIEVING, max, 0, true))
         {
             using (Utils.API.GeocachingLiveV6 client = new Utils.API.GeocachingLiveV6(Core, string.IsNullOrEmpty(Core.GeocachingComAccount.APIToken)))
             {
                 var req = new Utils.API.LiveV6.SearchForGeocachesRequest();
                 req.AccessToken = client.Token;
                 while (_importGeocaches.Count > 0)
                 {
                     req.CacheCode = new Utils.API.LiveV6.CacheCodeFilter();
                     req.CacheCode.CacheCodes = (from gc in _importGeocaches select gc).Take(10).ToArray();
                     req.GeocacheLogCount = 5;
                     req.IsLite = Core.GeocachingComAccount.MemberTypeId == 1;
                     req.MaxPerPage = req.CacheCode.CacheCodes.Length;
                     var resp = client.Client.SearchForGeocaches(req);
                     if (resp.Status.StatusCode == 0 && resp.Geocaches != null)
                     {
                         _importGeocaches.RemoveRange(0, req.CacheCode.CacheCodes.Length);
                         Utils.API.Import.AddGeocaches(Core, resp.Geocaches);
                     }
                     else
                     {
                         break;
                     }
                     if (!prog.UpdateProgress(STR_COPYSELECTION, STR_RETRIEVING, max, max - _importGeocaches.Count))
                     {
                         break;
                     }
                 }
             }
         }
     }
     catch
     {
     }
     _context.Send(new SendOrPostCallback(delegate(object state)
     {
         _frameworkUpdater.Dispose();
         _frameworkUpdater = null;
     }), null);
 }
开发者ID:RH-Code,项目名称:GAPP,代码行数:45,代码来源:ChatForm.cs

示例9: assignRegionsThreadMethod

 private void assignRegionsThreadMethod()
 {
     try
     {
         using (Utils.ProgressBlock prog = new Utils.ProgressBlock(_plugin, STR_ASSIGNINGREGION, STR_ASSIGNINGREGION, _gcList.Count, 0, true))
         {
             List<Framework.Data.AreaInfo> areasFilter = Utils.GeometrySupport.Instance.GetAreasByLevel(_level);
             if (areasFilter != null && areasFilter.Count > 0)
             {
                 int index = 0;
                 foreach (var gc in _gcList)
                 {
                     List<Framework.Data.AreaInfo> areas = Utils.GeometrySupport.Instance.GetAreasOfLocation(new Framework.Data.Location(gc.Lat, gc.Lon), areasFilter);
                     if (areas != null && areas.Count > 0)
                     {
                         Framework.Data.AreaInfo ai = areas[0];
                         if (_prefix.Length > 0)
                         {
                             ai = (from g in areas where g.Name.StartsWith(_prefix) select g).FirstOrDefault();
                         }
                         if (ai != null)
                         {
                             switch (_level)
                             {
                                 case Framework.Data.AreaType.Country:
                                     gc.Country = ai.Name;
                                     break;
                                 case Framework.Data.AreaType.State:
                                     gc.State = ai.Name;
                                     break;
                                 case Framework.Data.AreaType.Municipality:
                                     gc.Municipality = ai.Name;
                                     break;
                                 case Framework.Data.AreaType.City:
                                     gc.City = ai.Name;
                                     break;
                             }
                         }
                     }
                     index++;
                     if (index % 50 == 0)
                     {
                         if (!prog.UpdateProgress(STR_ASSIGNINGREGION, STR_ASSIGNINGREGION, _gcList.Count, index))
                         {
                             break;
                         }
                     }
                 }
             }
         }
     }
     catch
     {
     }
     _actionReady.Set();
 }
开发者ID:RH-Code,项目名称:GAPP,代码行数:56,代码来源:AssignRegionForm.cs

示例10: copyToSave


//.........这里部分代码省略.........
                                bw.Write(wp.Lon);
                                bw.Write(wp.Date.ToString("s"));

                                writeRecord(fc._usrwptsInDB, wp.ID.ToString(), ms, bw, fsUserWaypoints, memBuffer, extraBuffer, freeUserWaypointRecords);
                            }
                        }

                        List<Framework.Data.GeocacheImage> geocacheimglist = Utils.DataAccess.GetGeocacheImages(Core.GeocacheImages, gc.Code);
                        if (geocacheimglist.Count > 0)
                        {
                            recordLength = 0;
                            extraBuffer = new byte[100];
                            foreach (Framework.Data.GeocacheImage li in geocacheimglist)
                            {
                                //write to block
                                ms.Position = 0;

                                //block header
                                bw.Write(recordLength); //overwrite afterwards
                                bw.Write(notFree);
                                bw.Write(li.ID);
                                bw.Write(li.DataFromDate.ToString("s"));
                                bw.Write(li.GeocacheCode ?? "");
                                bw.Write(li.Description ?? "");
                                bw.Write(li.Name ?? "");
                                bw.Write(li.Url ?? "");
                                bw.Write(li.MobileUrl ?? "");
                                bw.Write(li.ThumbUrl ?? "");

                                writeRecord(fc._geocacheimgsInDB, li.ID.ToString(), ms, bw, fsGeocacheImages, memBuffer, extraBuffer, freeGeocacheImageRecords);
                            }
                        }


                        index++;
                        procStep++;
                        if (procStep >= 1000)
                        {
                            progress.UpdateProgress(STR_SAVING, STR_SAVINGGEOCACHES, CopyToList.Count, index);
                            procStep = 0;
                        }
                    }
                }
            }

            //**********************************************
            //fc.DatabaseInfoFilename
            //**********************************************
            XmlDocument doc = new XmlDocument();
            XmlElement root = doc.CreateElement("info");
            doc.AppendChild(root);

            XmlElement el = doc.CreateElement("IsLittleEndian");
            XmlText txt = doc.CreateTextNode(BitConverter.IsLittleEndian.ToString());
            el.AppendChild(txt);
            root.AppendChild(el);

            el = doc.CreateElement("GAPPVersion");
            txt = doc.CreateTextNode(Core.Version.ToString());
            el.AppendChild(txt);
            root.AppendChild(el);

            el = doc.CreateElement("StorageVersion");
            txt = doc.CreateTextNode("1");
            el.AppendChild(txt);
            root.AppendChild(el);

            el = doc.CreateElement("GeocacheCount");
            txt = doc.CreateTextNode((from RecordInfo ri in fc._geocachesInDB.Values where !ri.FreeSlot && !ri.ID.StartsWith("F_") select ri).Count().ToString());
            el.AppendChild(txt);
            root.AppendChild(el);

            el = doc.CreateElement("LogCount");
            txt = doc.CreateTextNode((from RecordInfo ri in fc._logsInDB.Values where !ri.FreeSlot && !ri.ID.StartsWith("F_") select ri).Count().ToString());
            el.AppendChild(txt);
            root.AppendChild(el);

            el = doc.CreateElement("LogImagesCount");
            txt = doc.CreateTextNode((from RecordInfo ri in fc._logimgsInDB.Values where !ri.FreeSlot select ri).Count().ToString());
            el.AppendChild(txt);
            root.AppendChild(el);

            el = doc.CreateElement("WaypointCount");
            txt = doc.CreateTextNode((from RecordInfo ri in fc._wptsInDB.Values where !ri.FreeSlot select ri).Count().ToString());
            el.AppendChild(txt);
            root.AppendChild(el);

            el = doc.CreateElement("UserWaypointCount");
            txt = doc.CreateTextNode((from RecordInfo ri in fc._usrwptsInDB.Values where !ri.FreeSlot select ri).Count().ToString());
            el.AppendChild(txt);
            root.AppendChild(el);

            el = doc.CreateElement("GeocacheImagesCount");
            txt = doc.CreateTextNode((from RecordInfo ri in fc._geocacheimgsInDB.Values where !ri.FreeSlot select ri).Count().ToString());
            el.AppendChild(txt);
            root.AppendChild(el);

            doc.Save(fc.DatabaseInfoFilename);
            return result;
        }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:101,代码来源:CopyTo.cs

示例11: ImportMethod

        protected override void ImportMethod()
        {
            bool cancelled = false;
            using (Utils.ProgressBlock blockprogress = new Utils.ProgressBlock(this, STR_IMPORTINGMYF, STR_IMPORTINGMYF, _users.Count, 0))
            {
                try
                {
                    using (var api = new Utils.API.GeocachingLiveV6(Core))
                    {
                        foreach (string usr in _users)
                        {
                            var logs = new List<Utils.API.LiveV6.GeocacheLog>();
                            int page = 0;
                            using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_IMPORTINGMYF, STR_IMPORTINGLOGS, 100, 0, true))
                            {
                                var req = new Utils.API.LiveV6.GetUsersGeocacheLogsRequest();
                                req.AccessToken = api.Token;
                                req.ExcludeArchived = true;
                                req.Username = usr;
                                req.MaxPerPage = 30;
                                req.StartIndex = 0;
                                if (PluginSettings.Instance.BetweenDates)
                                {
                                    req.Range = new Utils.API.LiveV6.DateRange();
                                    req.Range.StartDate = _fromDate < _toDate? _fromDate:_toDate;
                                    req.Range.EndDate = _toDate > _fromDate ? _toDate : _fromDate;
                                }
                                req.LogTypes = _logTypes.ToArray();
                                //req.LogTypes = new long[] { 2 };
                                var resp = api.Client.GetUsersGeocacheLogs(req);
                                while (resp.Status.StatusCode == 0)
                                {
                                    logs.AddRange(resp.Logs);

                                    //if (resp.Logs.Count() >= req.MaxPerPage)
                                    if (resp.Logs.Count() > 0)
                                    {
                                        page++;
                                        //req.StartIndex = logs.Count;
                                        req.StartIndex = page * req.MaxPerPage;
                                        if (!progress.UpdateProgress(STR_IMPORTINGMYF, STR_IMPORTINGLOGS, logs.Count + req.MaxPerPage, logs.Count))
                                        {
                                            cancelled = true;
                                            break;
                                        }
                                        System.Threading.Thread.Sleep(2100);
                                        resp = api.Client.GetUsersGeocacheLogs(req);
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                                if (resp.Status.StatusCode != 0)
                                {
                                    _errormessage = resp.Status.StatusMessage;
                                }
                            }

                            if (!cancelled)
                            {
                                foreach (var l in logs)
                                {
                                    AddLog(Utils.API.Convert.Log(Core, l));
                                }
                            }

                            //ok, we have the logs
                            //get the geocaches
                            if (PluginSettings.Instance.ImportMissingCaches && !cancelled && string.IsNullOrEmpty(_errormessage))
                            {
                                List<string> gcList = (from a in logs where a.CacheCode!=null && Utils.DataAccess.GetGeocache(Core.Geocaches, a.CacheCode) == null select a.CacheCode).ToList();
                                int maxToGet = gcList.Count;
                                using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_IMPORTINGMYF, STR_IMPORTINGCACHES, maxToGet, 0, true))
                                {
                                    int index = 0;
                                    int gcupdatecount = 20;

                                    while (gcList.Count > 0)
                                    {
                                        Utils.API.LiveV6.SearchForGeocachesRequest req = new Utils.API.LiveV6.SearchForGeocachesRequest();
                                        req.IsLite = Core.GeocachingComAccount.MemberTypeId == 1;
                                        req.AccessToken = api.Token;
                                        req.CacheCode = new Utils.API.LiveV6.CacheCodeFilter();
                                        req.CacheCode.CacheCodes = (from a in gcList select a).Take(gcupdatecount).ToArray();
                                        req.MaxPerPage = gcupdatecount;
                                        req.GeocacheLogCount = 0;
                                        index += req.CacheCode.CacheCodes.Length;
                                        gcList.RemoveRange(0, req.CacheCode.CacheCodes.Length);
                                        var resp = api.Client.SearchForGeocaches(req);
                                        if (resp.Status.StatusCode == 0 && resp.Geocaches != null)
                                        {
                                            if (resp.CacheLimits != null)
                                            {
                                                _apiLimit = resp.CacheLimits.MaxCacheCount;
                                                _apiLeft = resp.CacheLimits.CachesLeft;
                                            }
                                            Utils.API.Import.AddGeocaches(Core, resp.Geocaches);

                                            if (!progress.UpdateProgress(STR_IMPORTINGMYF, STR_IMPORTINGCACHES, maxToGet, maxToGet - gcList.Count))
//.........这里部分代码省略.........
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:101,代码来源:Import.cs

示例12: deleteSelectionThreadMethod

        private void deleteSelectionThreadMethod()
        {
            try
            {
                DateTime dt = DateTime.Now.AddSeconds(2);
                using (Utils.ProgressBlock prog = new Utils.ProgressBlock(this, STR_DELETINGGEOCACHES, STR_DELETINGGEOCACHES, _gcList.Count, 0, true))
                {
                    int index = 0;
                    foreach (Framework.Data.Geocache gc in _gcList)
                    {
                        Utils.DataAccess.DeleteGeocache(Core, gc);

                        index++;
                        if (DateTime.Now >= dt)
                        {
                            if (!prog.UpdateProgress(STR_DELETINGGEOCACHES, STR_DELETINGGEOCACHES, _gcList.Count, index))
                            {
                                break;
                            }
                            dt = DateTime.Now.AddSeconds(2);
                        }
                    }
                }
            }
            catch
            {
            }
            _actionReady.Set();
        }
开发者ID:RH-Code,项目名称:GAPP,代码行数:29,代码来源:Actions.cs

示例13: ImportMethod

 protected override void ImportMethod()
 {
     using (Utils.ProgressBlock fixpr = new Utils.ProgressBlock(this, STR_IMPORTING, STR_IMPORTINGDATA, _filenames.Length, 0))
     {
         for (int fileindex = 0; fileindex < _filenames.Length; fileindex++)
         {
             Utils.GPXProcessor gpxProcessor = new Utils.GPXProcessor(Core);
             Utils.GPXProcessor.ResultData res = gpxProcessor.ProcessGeocachingComGPXFile(_filenames[fileindex]);
             List<string> ignoredGeocaches = new List<string>();
             List<string> ignoredLogs = new List<string>();
             if (res != null && res.Geocaches.Count > 0)
             {
                 using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_IMPORTING, STR_IMPORTINGGEOCACHES, res.Geocaches.Count, 0))
                 {
                     int index = 0;
                     int procStep = 0;
                     foreach (Framework.Data.Geocache gc in res.Geocaches)
                     {
                         if (!AddGeocache(gc, gpxProcessor.CachesGPXVersion))
                         {
                             ignoredGeocaches.Add(gc.Code);
                         }
                         index++;
                         procStep++;
                         if (procStep >= 100)
                         {
                             progress.UpdateProgress(STR_IMPORTING, STR_IMPORTINGGEOCACHES, res.Geocaches.Count, index);
                             procStep = 0;
                         }
                     }
                 }
             }
             if (res != null && res.Waypoints.Count > 0)
             {
                 using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_IMPORTING, STR_IMPORTINGWAYPOINTS, res.Geocaches.Count, 0))
                 {
                     int index = 0;
                     int procStep = 0;
                     foreach (Framework.Data.Waypoint wp in res.Waypoints)
                     {
                         if (!ignoredGeocaches.Contains(wp.GeocacheCode))
                         {
                             AddWaypoint(wp);
                         }
                         index++;
                         procStep++;
                         if (procStep >= 200)
                         {
                             progress.UpdateProgress(STR_IMPORTING, STR_IMPORTINGWAYPOINTS, res.Waypoints.Count, index);
                             procStep = 0;
                         }
                     }
                 }
             }
             if (res != null && res.Logs.Count > 0)
             {
                 using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_IMPORTING, STR_IMPORTINGLOGS, res.Logs.Count, 0))
                 {
                     int index = 0;
                     int procStep = 0;
                     foreach (Framework.Data.Log l in res.Logs)
                     {
                         if (!ignoredGeocaches.Contains(l.GeocacheCode))
                         {
                             AddLog(l);
                         }
                         else
                         {
                             ignoredLogs.Add(l.ID);
                         }
                         index++;
                         procStep++;
                         if (procStep >= 500)
                         {
                             progress.UpdateProgress(STR_IMPORTING, STR_IMPORTINGLOGS, res.Logs.Count, index);
                             procStep = 0;
                         }
                     }
                 }
             }
             if (res != null && res.LogImages.Count > 0)
             {
                 using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_IMPORTING, STR_IMPORTINGLOGIMAGES, res.LogImages.Count, 0))
                 {
                     int index = 0;
                     int procStep = 0;
                     foreach (Framework.Data.LogImage l in res.LogImages)
                     {
                         if (!ignoredLogs.Contains(l.LogID))
                         {
                             AddLogImage(l);
                         }
                         index++;
                         procStep++;
                         if (procStep >= 100)
                         {
                             progress.UpdateProgress(STR_IMPORTING, STR_IMPORTINGLOGIMAGES, res.LogImages.Count, index);
                             procStep = 0;
                         }
                     }
//.........这里部分代码省略.........
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:101,代码来源:GpxImport.cs

示例14: ImportMethod


//.........这里部分代码省略.........
                                gc.AttributeIds = attrList;

                                gc.Notes = (string)dr["UserNote"];
                                gc.PublishedTime = DateTime.Parse((string)dr["PlacedDate"]);
                                if (isGCNoteAvailable)
                                {
                                    gc.PersonaleNote = (string)dr["gcnote"];
                                }
                                else
                                {
                                    gc.PersonaleNote = "";
                                }
                                gc.Flagged = (int)dr["UserFlag"] != 0;
                                gc.Found = (int)dr["Found"] != 0;

                                if (isFavPointAvailable)
                                {
                                    gc.Favorites = (int)(int)dr["FavPoints"];
                                }
                                else
                                {
                                    gc.Favorites = 0;
                                }

                                gc.Selected = false;

                                Calculus.SetDistanceAndAngleGeocacheFromLocation(gc, Core.CenterLocation);

                                AddGeocache(gc, null);
                                index++;
                                procStep++;
                                if (procStep >= 500)
                                {
                                    progress.UpdateProgress(STR_IMPORTING, STR_IMPORTINGGEOCACHES, gcCount, index);
                                    procStep = 0;
                                }
                            }
                            dr.Close();
                        }

                        import.CommandText = "select count(1) from logs";
                        int logCount = (int)(long)import.ExecuteScalar();
                        if (logCount > 0)
                        {
                            using (Utils.ProgressBlock progress = new Utils.ProgressBlock(this, STR_IMPORTING, STR_IMPORTINGLOGS, logCount, 0))
                            {
                                index = 0;
                                procStep = 0;
                                import.CommandText = "select l.lLogId, l.lParent, lDate, lTime, lBy, lownerid, lEncoded, lType, lText " +
                                    " from logs l" +
                                    " inner join logmemo m on m.lLogId = l.lLogId and m.lParent = l.lParent";
                                DbDataReader dr = import.ExecuteReader();
                                while (dr.Read())
                                {
                                    Framework.Data.Log lg = new Framework.Data.Log();

                                    String type = (String)dr["lType"];
                                    int logType = (int)logTypes[type];

                                    //id text, gccode text, tbcode text, date text, finder text, finderid text, logtext text, encoded integer, datafromdate text, logtype integer
                                    lg.ID = dr["lLogiD"].ToString();
                                    lg.GeocacheCode = (string)dr["lParent"];
                                    lg.TBCode = "";
                                    lg.Date = (DateTime)dr["lDate"];
                                    lg.Finder = (string)dr["lBy"];
                                    lg.FinderId = dr["lownerid"].ToString();
开发者ID:RH-Code,项目名称:GAPP,代码行数:67,代码来源:ImportGSAK.cs

示例15: purgeLogsThreadMethod

 private void purgeLogsThreadMethod()
 {
     try
     {
         int max = Core.Geocaches.Count;
         int index = 0;
         using (Utils.ProgressBlock prog = new Utils.ProgressBlock(this, STR_PURGINGLOGS, STR_PURGINGLOGS, max, index, true))
         {
             string me = Core.GeocachingComAccount.AccountName;
             foreach (Framework.Data.Geocache gc in Core.Geocaches)
             {
                 /*
                 List<Framework.Data.Log> logs = (from Framework.Data.Log l in Core.Logs
                                                  where l.GeocacheCode == gc.Code && l.Finder != Core.GeocachingComAccount.AccountName
                                                  orderby l.Date descending
                                                  select l).Skip(5).ToList();
                  */
                 List<Framework.Data.Log> lgs = Utils.DataAccess.GetLogs(Core.Logs, gc.Code);
                 if (lgs != null)
                 {
                     var logs = (from l in lgs
                                 where l.Finder != me
                                 select l).Skip(5);
                     foreach (var l in logs)
                     {
                         Utils.DataAccess.DeleteLog(Core, l);
                     }
                 }
                 index++;
                 if (index % 50 == 0)
                 {
                     if (!prog.UpdateProgress(STR_PURGINGLOGS, STR_PURGINGLOGS, max, index))
                     {
                         break;
                     }
                 }
             }
         }
     }
     catch
     {
     }
     _actionReady.Set();
 }
开发者ID:RH-Code,项目名称:GAPP,代码行数:44,代码来源:LogPurger.cs


注:本文中的Utils.ProgressBlock.UpdateProgress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。