Esempio n. 1
0
 public static FormProgressHandler Create(Framework.Interfaces.ICore core, Form owner)
 {
     if (_uniqueInstance == null)
     {
         _uniqueInstance = new FormProgressHandler(core, owner);
     }
     return(_uniqueInstance);
 }
Esempio n. 2
0
 public void Dispose()
 {
     if (_uniqueInstance == this)
     {
         _uniqueInstance = null;
     }
     if (_frmDlg != null)
     {
         _frmDlg.Dispose();
         _frmDlg = null;
     }
     if (_core != null)
     {
         List <Framework.Interfaces.IPlugin> pl = _core.GetPlugins();
         foreach (Framework.Interfaces.IPlugin p in pl)
         {
             p.EndProgress    -= new Framework.EventArguments.ProgressEventHandler(p_EndProgress);
             p.StartProgress  -= new Framework.EventArguments.ProgressEventHandler(p_StartProgress);
             p.UpdateProgress -= new Framework.EventArguments.ProgressEventHandler(p_UpdateProgress);
         }
     }
 }
Esempio n. 3
0
        public FormMain(Utils.BasePlugin.BaseUIMainWindow ownerPlugin, Framework.Interfaces.ICore core)
            : base(ownerPlugin, core)
        {
            var sett = new PluginSettings(core);

            InitializeComponent();

            core.LanguageItems.AddRange(FormSettings.LanguageItems);
            core.LanguageItems.AddRange(FormSettingsTreeView.LanguageItems);
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_FILE));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_IMPORT));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_EXPORT));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_SEARCH));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_ACTION));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_ACTIONSEQUNCER));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_SCRIPTS));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_LIVEAPI));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_OKAPI));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_LANGUAGE));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_ORIGINALTEXT));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_PLUGINS));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_WINDOW));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_HELP));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_ABOUT));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_SETTINGS));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_ASKSAVEDATA));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_WARNING));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_HOME));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_CENTER));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_NOCACHESELECTED));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_FORUM));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_MAPS));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_TOOLBAR));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_EXECUTE));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_CUSTOMTOOLBAR));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_INSTRUCTIONVIDEOS));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_CHANGEHISTORY));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(STR_EXIT));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(CustomToolbarSettingForm.STR_OK));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(CustomToolbarSettingForm.STR_SHOWTOOLBAR));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(CustomToolbarSettingForm.STR_TITLE));
            core.LanguageItems.Add(new Framework.Data.LanguageItem(NotificationContainer.STR_TITLE));

            //file toolbar
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.InternalStorage, "Save", "", Properties.Resources.database_save, toolStripFile));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.InternalStorage, "New", "", Properties.Resources.database_add, toolStripFile));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.InternalStorage, "Open", "", Properties.Resources.database, toolStripFile));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.ExportData, "Export Garmin POI", "All", Properties.Resources.exportpoi, toolStripFile));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.ExportData, "Export Garmin POI", "Selected", Properties.Resources.exportpoisel, toolStripFile));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.ImportData, "Import GCVote", "All", Properties.Resources.gcvote, toolStripFile));

            //search toolbar
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.GeocacheSelectFilter, "Search geocache", "", Properties.Resources.magnifier__plus, toolStripSearch));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.GeocacheSelectFilter, "Search geocache by text", "", Properties.Resources.magnifier__pencil, toolStripSearch));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.GeocacheSelectFilter, "Quick Select", "Clear selection", Properties.Resources.deselect_all, toolStripSearch));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.GeocacheSelectFilter, "Quick Select", "Select All", Properties.Resources.select_all, toolStripSearch));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.GeocacheSelectFilter, "Select geocaches by area", "", Properties.Resources.selectarea, toolStripSearch));

            //script toolbar
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.PluginManager, "Package manager", "", Properties.Resources.download, toolStripScripts));

            //windows toolbar
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.UIChildWindow, "Chat", "", Properties.Resources.chat, toolStripWindows));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.UIChildWindow, "Generate statistics", "", Properties.Resources.statistics, toolStripWindows));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.UIChildWindow, "Geocache Editor", "", Properties.Resources.gcedit, toolStripWindows));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.UIChildWindow, "Waypoint Editor", "", Properties.Resources.wpedit, toolStripWindows));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.UIChildWindow, "View Geocache", "", Properties.Resources.view, toolStripWindows));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.UIChildWindow, "Simple cache list", "", Properties.Resources.list, toolStripWindows));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.UIChildWindow, "Solver", "", Properties.Resources.solver, toolStripWindows));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.UIChildWindow, "Web browser", "", Properties.Resources.browser, toolStripWindows));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.GenericWindow, "Presets", "Splitscreen", Properties.Resources.Icon_Split, toolStripWindows));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.UIChildWindow, "GCVote dashboard", "", Properties.Resources.gcvote, toolStripWindows));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.GeocacheCollection, "Geocache collections", "", Properties.Resources.categories, toolStripWindows));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.UIChildWindow, "Formula Solver", "", Properties.Resources.mathematics, toolStripWindows));

            //maps toolbar
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.Map, "Google Map", "", Properties.Resources.google, toolStripMaps));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.Map, "OpenLayers Map", "", Properties.Resources.openlayers, toolStripMaps));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.Map, "Open street map - online", "", Properties.Resources.osm, toolStripMaps));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.Map, "Open street map - offline", "", Properties.Resources.maps, toolStripMaps));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.Map, "Google road map - online", "", Properties.Resources.google2, toolStripMaps));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.Map, "Open areas", "", Properties.Resources.holes, toolStripMaps));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.Map, "Google Earth", "", Properties.Resources.googleearth, toolStripMaps));

            //Live API toolbar
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.LiveAPI, "Import Pocket Queries", "", Properties.Resources.dbimport, toolStripLiveAPI));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.LiveAPI, "Import geocaches", "", Properties.Resources.Importgc, toolStripLiveAPI));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.LiveAPI, "Log geocache", "Single", Properties.Resources.found, toolStripLiveAPI));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.LiveAPI, "Log geocache", "Selected", Properties.Resources.foundmore, toolStripLiveAPI));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.LiveAPI, "Image Gallery", "", Properties.Resources.image, toolStripLiveAPI));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.LiveAPI, "Trackable groups", "", Properties.Resources.travelbug, toolStripLiveAPI));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.LiveAPI, "Log trackables", "", Properties.Resources._48, toolStripLiveAPI));

            //actions toolbar
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.Action, "Action builder", "Editor", Properties.Resources.Flowchart, toolStripActions));
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.Action, "Action builder", "Download and publish", Properties.Resources.server, toolStripActions));

            //actions sequence toolbar
            _toolbarActionProperties.Add(new ToolbarActionProperties(Framework.PluginType.Action, "Action sequence", "Edit", Properties.Resources.sequence, toolStripActionSequence));

            _notificationContainer = new NotificationContainer(this);
            _notificationContainer.Visible = false;
            this.Controls.Add(_notificationContainer);
            _frmProgress = FormProgressHandler.Create(core, this);
            UpdateLocations();
            UpdateCountStatus();

            this.Icon = Properties.Resources.Globalcaching;
            bool maximize = PluginSettings.Instance.WindowMaximized;
            if (PluginSettings.Instance.WindowPos != null && !PluginSettings.Instance.WindowPos.IsEmpty)
            {
                this.Bounds = PluginSettings.Instance.WindowPos;
            }
            if (maximize)
            {
                this.WindowState = FormWindowState.Maximized;
            }

            SelectedLanguageChanged(this, EventArgs.Empty);

            List<Framework.Interfaces.IPlugin> pl = core.GetPlugins();
            foreach (Framework.Interfaces.IPlugin p in pl)
            {
                p.Notification += new Framework.EventArguments.NotificationEventHandler(p_Notification);
            }
            core.PluginAdded += new Framework.EventArguments.PluginEventHandler(core_PluginAdded);


            core.ShortcutInfoChanged += new EventHandler(core_ShortcutInfoChanged);
            core.ActiveGeocacheChanged += new Framework.EventArguments.GeocacheEventHandler(core_ActiveGeocacheChanged);

            core_ActiveGeocacheChanged(this, null);

            foreach( ToolStripMenuItem p in toolStripSplitButtonTranslate.DropDownItems)
            {
                if (p.Tag != null && p.Tag.ToString() == PluginSettings.Instance.SelectedTranslater)
                {
                    toolStripSplitButtonTranslate.Image = p.Image;
                }
            }
            
        }
Esempio n. 4
0
 private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (_allowedToClose)
     {
         Core.PluginAdded -= new Framework.EventArguments.PluginEventHandler(core_PluginAdded);
         Core.PrepareClosingApplication();
         if (_frmProgress != null)
         {
             _frmProgress.Dispose();
             _frmProgress = null;
         }
     }
     else
     {
         e.Cancel = true;
         this.BeginInvoke((Action)(() => { _exitMeniItem_Click(null, EventArgs.Empty); }));
     }
 }
Esempio n. 5
0
 private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (Core.AutoSaveOnClose)
     {
         Framework.Interfaces.IPluginInternalStorage p = (from Framework.Interfaces.IPluginInternalStorage ip in Core.GetPlugin(Framework.PluginType.InternalStorage) select ip).FirstOrDefault();
         if (p != null)
         {
             e.Cancel = !p.SaveAllData();
         }
     }
     else
     {
         int cnt = 0;
         cnt += (from Framework.Data.Geocache c in Core.Geocaches where !c.Saved select c).Count();
         cnt += (from Framework.Data.Log c in Core.Logs where !c.Saved select c).Count();
         cnt += (from Framework.Data.LogImage c in Core.LogImages where !c.Saved select c).Count();
         cnt += (from Framework.Data.Waypoint c in Core.Waypoints where !c.Saved select c).Count();
         if (cnt > 0)
         {
             System.Windows.Forms.DialogResult res = MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_ASKSAVEDATA), Utils.LanguageSupport.Instance.GetTranslation(STR_WARNING), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3);
             if (res == System.Windows.Forms.DialogResult.Yes)
             {
                 Framework.Interfaces.IPluginInternalStorage p = (from Framework.Interfaces.IPluginInternalStorage ip in Core.GetPlugin(Framework.PluginType.InternalStorage) select ip).FirstOrDefault();
                 if (p != null)
                 {
                     e.Cancel = !p.SaveAllData();
                 }
             }
             else if (res == System.Windows.Forms.DialogResult.No)
             {
             }
             else
             {
                 e.Cancel = true;
             }
         }
     }
     if (!e.Cancel)
     {
         Core.PluginAdded -= new Framework.EventArguments.PluginEventHandler(core_PluginAdded);
         Core.PrepareClosingApplication();
         if (_frmProgress != null)
         {
             _frmProgress.Dispose();
             _frmProgress = null;
         }
     }
 }
Esempio n. 6
0
 public void Dispose()
 {
     if (_uniqueInstance == this)
     {
         _uniqueInstance = null;
     }
     if (_frmDlg != null)
     {
         _frmDlg.Dispose();
         _frmDlg = null;
     }
     if (_core != null)
     {
         List<Framework.Interfaces.IPlugin> pl = _core.GetPlugins();
         foreach (Framework.Interfaces.IPlugin p in pl)
         {
             p.EndProgress -= new Framework.EventArguments.ProgressEventHandler(p_EndProgress);
             p.StartProgress -= new Framework.EventArguments.ProgressEventHandler(p_StartProgress);
             p.UpdateProgress -= new Framework.EventArguments.ProgressEventHandler(p_UpdateProgress);
         }
     }
 }
Esempio n. 7
0
 public static FormProgressHandler Create(Framework.Interfaces.ICore core, Form owner)
 {
     if (_uniqueInstance == null)
     {
         _uniqueInstance = new FormProgressHandler(core, owner);
     }
     return (_uniqueInstance);
 }