private async void button6_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0 && await addGeocachesToDatabase((from ListViewItem a in listView1.SelectedItems select a).ToList()))
     {
         GeocacheBatchLogForm dlg = new GeocacheBatchLogForm(_plugin, _core, _client, false);
         foreach (ListViewItem lvi in listView1.SelectedItems)
         {
             Framework.Data.Geocache gc = Utils.DataAccess.GetGeocache(_core.Geocaches, (lvi.Tag as GeocacheVisitsItem).Code);
             if (gc != null)
             {
                 dlg.AddGeocache(gc, (lvi.Tag as GeocacheVisitsItem).LogDate);
             }
         }
         dlg.ShowDialog();
     }
 }
Example #2
0
        public override bool Action(string action)
        {
            bool result = base.Action(action);

            if (result)
            {
                try
                {
                    //get from goundspeak
                    if (Utils.API.GeocachingLiveV6.CheckAPIAccessAvailable(Core, false))
                    {
#if DEBUG
                        //using (var client = new Utils.API.GeocachingLiveV6(Core, true))
                        using (var client = new Utils.API.GeocachingLiveV6(Core))
#else
                        using (var client = new Utils.API.GeocachingLiveV6(Core))
#endif
                        {
                            if (action == ACTION_SINGLE)
                            {
                                using (GeocacheLogForm dlg = new GeocacheLogForm(Core, client, Core.ActiveGeocache))
                                {
                                    dlg.ShowDialog();
                                }
                            }
                            else if (action == ACTION_BATCH)
                            {
                                using (GeocacheBatchLogForm dlg = new GeocacheBatchLogForm(this, Core, client))
                                {
                                    dlg.ShowDialog();
                                }
                            }
                            else if (action == ACTION_GARMINVISIT)
                            {
                                using (GarminGeocacheVisitsLogForm dlg = new GarminGeocacheVisitsLogForm(this, Core, client))
                                {
                                    dlg.ShowDialog();
                                }
                            }
                            else if (action == ACTION_CGEOVISIT)
                            {
                                using (CGeoGeocacheVisitsLogForm dlg = new CGeoGeocacheVisitsLogForm(this, Core, client))
                                {
                                    dlg.ShowDialog();
                                }
                            }
                            else if (action == ACTION_OFFLINE)
                            {
                                using (OfflineLogForm dlg = new OfflineLogForm(this, Core, client))
                                {
                                    dlg.ShowDialog();
                                }
                            }
                        }
                    }
                }
                catch
                {
                    System.Windows.Forms.MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_UNABLEACCESSAPI), Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
            }
            return(result);
        }
Example #3
0
        public override bool Action(string action)
        {
            bool result = base.Action(action);
            if (result)
            {
                try
                {
                    //get from goundspeak
                    if (Utils.API.GeocachingLiveV6.CheckAPIAccessAvailable(Core, false))
                    {
#if DEBUG
                        //using (var client = new Utils.API.GeocachingLiveV6(Core, true))
                        using (var client = new Utils.API.GeocachingLiveV6(Core))
#else
                        using (var client = new Utils.API.GeocachingLiveV6(Core))
#endif
                        {
                            if (action == ACTION_SINGLE)
                            {
                                using (GeocacheLogForm dlg = new GeocacheLogForm(Core, client, Core.ActiveGeocache))
                                {
                                    dlg.ShowDialog();
                                }
                            }
                            else if (action == ACTION_BATCH)
                            {
                                using (GeocacheBatchLogForm dlg = new GeocacheBatchLogForm(this, Core, client))
                                {
                                    dlg.ShowDialog();
                                }
                            }
                            else if (action == ACTION_GARMINVISIT)
                            {
                                using (GarminGeocacheVisitsLogForm dlg = new GarminGeocacheVisitsLogForm(this, Core, client))
                                {
                                    dlg.ShowDialog();
                                }
                            }
                            else if (action == ACTION_CGEOVISIT)
                            {
                                using (CGeoGeocacheVisitsLogForm dlg = new CGeoGeocacheVisitsLogForm(this, Core, client))
                                {
                                    dlg.ShowDialog();
                                }
                            }
                            else if (action == ACTION_OFFLINE)
                            {
                                using (OfflineLogForm dlg = new OfflineLogForm(this, Core, client))
                                {
                                    dlg.ShowDialog();
                                }
                            }
                        }
                    }
                }
                catch
                {
                    System.Windows.Forms.MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_UNABLEACCESSAPI), Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
            }
            return result;
        }
 private void button6_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0 && addGeocachesToDatabase((from ListViewItem a in listView1.SelectedItems select a).ToList()))
     {
         GeocacheBatchLogForm dlg = new GeocacheBatchLogForm(_plugin, _core, _client, false);
         foreach (ListViewItem lvi in listView1.SelectedItems)
         {
             Framework.Data.Geocache gc = Utils.DataAccess.GetGeocache(_core.Geocaches, (lvi.Tag as GeocacheVisitsItem).Code);
             if (gc != null)
             {
                 dlg.AddGeocache(gc, (lvi.Tag as GeocacheVisitsItem).LogDate);
             }
         }
         dlg.ShowDialog();
     }
 }