Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            List <OfflineLogInfo> processed = new List <OfflineLogInfo>();

            foreach (OfflineLogInfo oi in listBox1.Items)
            {
                Framework.Data.Geocache gc = Utils.DataAccess.GetGeocache(_core.Geocaches, oi.GeocacheCode);
                if (gc == null)
                {
                    gc = getGeocache(oi.GeocacheCode);
                }
                if (gc != null)
                {
                    using (GeocacheLogForm dlg = new GeocacheLogForm(_core, _client, gc, oi))
                    {
                        if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            processed.Add(oi);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            foreach (OfflineLogInfo oi in processed)
            {
                listBox1.Items.Remove(oi);
            }
        }
 private async void button4_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0 && await addGeocachesToDatabase((from ListViewItem a in listView1.SelectedItems select a).ToList()))
     {
         //right order
         List <ListViewItem> lvil = new List <ListViewItem>();
         foreach (ListViewItem lvi in listView1.Items)
         {
             if (lvi.Selected)
             {
                 lvil.Add(lvi);
             }
         }
         foreach (ListViewItem lvi in lvil)
         {
             Framework.Data.Geocache gc = Utils.DataAccess.GetGeocache(_core.Geocaches, (lvi.Tag as GeocacheVisitsItem).Code);
             if (gc != null)
             {
                 using (GeocacheLogForm dlg = new GeocacheLogForm(_core, _client, gc, lvil[0].Tag as GeocacheVisitsItem))
                 {
                     dlg.AskForNext = false;
                     if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                     {
                         break;
                     }
                 }
             }
         }
     }
 }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            OfflineLogInfo oi = listBox1.SelectedItem as OfflineLogInfo;

            if (oi != null)
            {
                Framework.Data.Geocache gc = Utils.DataAccess.GetGeocache(_core.Geocaches, oi.GeocacheCode);
                if (gc == null)
                {
                    gc = getGeocache(oi.GeocacheCode);
                }
                if (gc != null)
                {
                    using (GeocacheLogForm dlg = new GeocacheLogForm(_core, _client, gc, oi))
                    {
                        if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            listBox1.Items.Remove(oi);
                        }
                    }
                }
            }
        }
Beispiel #4
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);
        }
Beispiel #5
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;
        }
Beispiel #6
0
 private void button2_Click(object sender, EventArgs e)
 {
     List<OfflineLogInfo> processed = new List<OfflineLogInfo>();
     foreach (OfflineLogInfo oi in listBox1.Items)
     {
         Framework.Data.Geocache gc = Utils.DataAccess.GetGeocache(_core.Geocaches, oi.GeocacheCode);
         if (gc == null)
         {
             gc = getGeocache(oi.GeocacheCode);
         }
         if (gc != null)
         {
             using (GeocacheLogForm dlg = new GeocacheLogForm(_core, _client, gc, oi))
             {
                 if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     processed.Add(oi);
                 }
                 else
                 {
                     break;
                 }
             }
         }
     }
     foreach (OfflineLogInfo oi in processed)
     {
         listBox1.Items.Remove(oi);
     }
 }
Beispiel #7
0
 private void button1_Click(object sender, EventArgs e)
 {
     OfflineLogInfo oi = listBox1.SelectedItem as OfflineLogInfo;
     if (oi != null)
     {
         Framework.Data.Geocache gc = Utils.DataAccess.GetGeocache(_core.Geocaches, oi.GeocacheCode);
         if (gc == null)
         {
             gc = getGeocache(oi.GeocacheCode);
         }
         if (gc != null)
         {
             using (GeocacheLogForm dlg = new GeocacheLogForm(_core, _client, gc, oi))
             {
                 if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     listBox1.Items.Remove(oi);
                 }
             }
         }
     }            
 }
 private void button4_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0 && addGeocachesToDatabase((from ListViewItem a in listView1.SelectedItems select a).ToList()))
     {
         //right order
         List<ListViewItem> lvil = new List<ListViewItem>();
         foreach (ListViewItem lvi in listView1.Items)
         {
             if (lvi.Selected)
             {
                 lvil.Add(lvi);
             }
         }
         foreach (ListViewItem lvi in lvil)
         {
             Framework.Data.Geocache gc = Utils.DataAccess.GetGeocache(_core.Geocaches, (lvi.Tag as GeocacheVisitsItem).Code);
             if (gc != null)
             {
                 using (GeocacheLogForm dlg = new GeocacheLogForm(_core, _client, gc, lvil[0].Tag as GeocacheVisitsItem))
                 {
                     dlg.AskForNext = false;
                     if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                     {
                         break;
                     }
                 }
             }
         }
     }
 }