Example #1
0
        public async override Task <bool> ActionAsync(string action)
        {
            bool result = base.Action(action);

            if (result)
            {
                if (action == ACTION_EXPORT_ALL || action == ACTION_EXPORT_SELECTED || action == ACTION_EXPORT_ACTIVE)
                {
                    if (action == ACTION_EXPORT_ALL)
                    {
                        gcList = (from Framework.Data.Geocache a in Core.Geocaches select a).ToList();
                    }
                    else if (action == ACTION_EXPORT_SELECTED)
                    {
                        gcList = Utils.DataAccess.GetSelectedGeocaches(Core.Geocaches);
                    }
                    else if (action == ACTION_EXPORT_ACTIVE)
                    {
                        if (Core.ActiveGeocache != null)
                        {
                            gcList = new List <Framework.Data.Geocache>();
                            gcList.Add(Core.ActiveGeocache);
                        }
                    }
                    if (gcList == null || gcList.Count == 0)
                    {
                        System.Windows.Forms.MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_NOGEOCACHESELECTED), Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    }
                    else
                    {
                        using (GarminPOIExportForm dlg = new GarminPOIExportForm())
                        {
                            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                await PerformExport();
                            }
                        }
                    }
                }
            }
            return(result);
        }
Example #2
0
 public async override Task<bool> ActionAsync(string action)
 {
     bool result = base.Action(action);
     if (result)
     {
         if (action == ACTION_EXPORT_ALL || action == ACTION_EXPORT_SELECTED || action == ACTION_EXPORT_ACTIVE)
         {
             if (action == ACTION_EXPORT_ALL)
             {
                 gcList = (from Framework.Data.Geocache a in Core.Geocaches select a).ToList();
             }
             else if (action == ACTION_EXPORT_SELECTED)
             {
                 gcList = Utils.DataAccess.GetSelectedGeocaches(Core.Geocaches);
             }
             else if (action == ACTION_EXPORT_ACTIVE)
             {
                 if (Core.ActiveGeocache != null)
                 {
                     gcList = new List<Framework.Data.Geocache>();
                     gcList.Add(Core.ActiveGeocache);
                 }
             }
             if (gcList == null || gcList.Count == 0)
             {
                 System.Windows.Forms.MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_NOGEOCACHESELECTED), Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
             }
             else
             {
                                         
                 using (GarminPOIExportForm dlg = new GarminPOIExportForm())
                 {
                     if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                     {
                         await PerformExport();
                     }
                 }
                 
             }
         }
     }
     return result;
 }