Пример #1
0
        public SettingsPanel(Framework.Interfaces.ICore core)
        {
            InitializeComponent();

            this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_INFO);
            this.buttonClear.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CLEAR);

            List<Framework.Data.ShortcutInfo> scuts = core.ShortcutInfo;
            List<Framework.Interfaces.IPlugin> pins = core.GetPlugins();
            foreach (Framework.Interfaces.IPlugin p in pins)
            {
                List<string> actions = p.GetActionSubactionList('@');
                foreach (string act in actions)
                {
                    string[] parts = act.Split(new char[] { '@' });
                    ListViewItem lvi = new ListViewItem(new string[] { p.GetType().ToString(), Utils.LanguageSupport.Instance.GetTranslation(parts[0]), parts.Length==1?"": Utils.LanguageSupport.Instance.GetTranslation(parts[1]), "" });
                    lvi.Tag = p;
                    listView1.Items.Add(lvi);
                    Framework.Data.ShortcutInfo sc = (from t in scuts where t.PluginType == p.GetType().ToString() && t.PluginAction == parts[0] && (parts.Length==1 || t.PluginSubAction == parts[1]) select t).FirstOrDefault();
                    lvi.SubItems[0].Tag = p.GetType().ToString();
                    lvi.SubItems[1].Tag = parts[0];
                    lvi.SubItems[2].Tag = parts.Length==1?"":parts[1];
                    if (sc != null)
                    {
                        lvi.SubItems[3].Text = sc.ShortcutKeyString;
                        lvi.SubItems[3].Tag = sc.ShortcutKeys;
                    }
                    else
                    {
                        lvi.SubItems[3].Tag = null;
                    }
                }
            }
        }
Пример #2
0
        public FormSettings(Framework.Interfaces.ICore core, Utils.BasePlugin.Plugin ownerPlugin)
            : this()
        {
            this.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.tabPageGeneral.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_GENERAL);
            this.groupBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_GCCOMACCOUNT);
            this.buttonAuthorize.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_AUTHORIZE);
            this.groupBox2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_PLUGINS);
            this.buttonApply.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_APPLY);
            this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NAME);
            this.label2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_API);
            this.label3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MENBERSHIP);
            this.label7.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_INTERNALSTORAGE);
            this.checkBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_LOADINBACKGROUND);

            _core = core;
            _ownerPlugin = ownerPlugin;
            _pluginList = core.GetPlugins();
            List<string> allPlugins = core.GetAllDetectedPlugins();
            checkedListBoxPlugins.Items.AddRange(allPlugins.ToArray());
            foreach (Framework.Interfaces.IPlugin p in _pluginList)
            {
                int index = checkedListBoxPlugins.Items.IndexOf(p.GetType().FullName);
                if (index >= 0)
                {
                    checkedListBoxPlugins.SetItemChecked(index, true);
                }
                List<UserControl> pnls = p.CreateConfigurationPanels();
                if (pnls != null && pnls.Count > 0)
                {
                    _ucList.AddRange(pnls.ToArray());

                    //create tab
                    TabPage tp = new TabPage(Utils.LanguageSupport.Instance.GetTranslation(p.FriendlyName));
                    tp.AutoScroll = true;
                    tabControlSettings.TabPages.Add(tp);
                    //add controls
                    FlowLayoutPanel fp = new FlowLayoutPanel();
                    tp.Controls.Add(fp);
                    fp.Dock = DockStyle.Fill;
                    fp.Controls.AddRange(pnls.ToArray());
                }
            }
            comboBoxInternalStorage.Items.AddRange(core.GetAvailableInternalStoragePlugins().ToArray());
            comboBoxInternalStorage.SelectedItem = core.ActiveInternalStoragePlugin;
            textBoxUsername.Text = core.GeocachingComAccount.AccountName;
            labelApiEnabled.Text = string.IsNullOrEmpty(core.GeocachingComAccount.APIToken) ? Utils.LanguageSupport.Instance.GetTranslation(STR_NO) : Utils.LanguageSupport.Instance.GetTranslation(STR_YES);
            labelApiMembership.Text = string.IsNullOrEmpty(core.GeocachingComAccount.MemberType) ? "-" : core.GeocachingComAccount.MemberType;
            checkBox1.Checked = core.LoadLogsInBackground;
        }
Пример #3
0
        public SelectActionForm(Framework.Interfaces.ICore core)
            : this()
        {
            this.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.button1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SELECT);
            this.listView1.Columns[0].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_PLUGIN);
            this.listView1.Columns[1].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ACTION);
            this.listView1.Columns[2].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SUBACTION);

            char[] sep = new char[]{'|'};
            List<SequenceInfo.ActionInfo> allActions = new List<SequenceInfo.ActionInfo>();
            List<Framework.Interfaces.IPlugin> plugins = core.GetPlugins();
            foreach (var p in plugins)
            {
                List<string> actions = p.GetActionSubactionList(sep[0]);
                foreach (string s in actions)
                {
                    string[] parts = s.Split(sep, 2);
                    SequenceInfo.ActionInfo ai = new SequenceInfo.ActionInfo();
                    ai.Plugin = p.GetType().ToString();
                    ai.Action = parts[0];
                    if (parts.Length == 2)
                    {
                        ai.SubAction = parts[1];
                    }
                    else
                    {
                        ai.SubAction = "";
                    }
                    allActions.Add(ai);
                }
            }
            var allact = (from a in allActions select a).OrderBy(x => x.Plugin).ThenBy(x => x.Action).ThenBy(x => x.SubAction);
            foreach (var a in allact)
            {
                ListViewItem lvi = new ListViewItem(new string[]{
                Utils.LanguageSupport.Instance.GetTranslation(a.Plugin),
                Utils.LanguageSupport.Instance.GetTranslation(a.Action),
                Utils.LanguageSupport.Instance.GetTranslation(a.SubAction)
                });
                lvi.Tag = a;
                listView1.Items.Add(lvi);
            }

            listView1.ListViewItemSorter = new Utils.ListViewColumnSorter();
            (listView1.ListViewItemSorter as Utils.ListViewColumnSorter).SortColumn = 0;
            (listView1.ListViewItemSorter as Utils.ListViewColumnSorter).Order = SortOrder.Ascending;

        }
Пример #4
0
        public SettingsPanel(Framework.Interfaces.ICore core)
            : this()
        {
            this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_INFO);
            this.buttonSort.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SORT);

            //first the selected
            if (Properties.Settings.Default.Startup != null && Properties.Settings.Default.Startup.Count > 0)
            {
                foreach (string s in Properties.Settings.Default.Startup)
                {
                    string[] parts = s.Split(new char[] { '@' }, 2);
                    Framework.Interfaces.IPlugin p = Utils.PluginSupport.PluginByName(core, parts[0]);
                    if (p != null)
                    {
                        List<string> actions = p.GetActionSubactionList('@');
                        if (actions.Contains(parts[1]))
                        {
                            string[] act = parts[1].Split(new char[] { '@' });
                            ListViewItem lvi = new ListViewItem(new string[] { p.GetType().ToString(), Utils.LanguageSupport.Instance.GetTranslation(parts[0]), act.Length == 1 ? "" : Utils.LanguageSupport.Instance.GetTranslation(act[1]), "" });
                            lvi.Tag = s;
                            lvi.Checked = true;
                            listView1.Items.Add(lvi);
                        }
                    }
                }
            }

            List<Framework.Interfaces.IPlugin> pins = core.GetPlugins();
            foreach (Framework.Interfaces.IPlugin p in pins)
            {
                List<string> actions = p.GetActionSubactionList('@');
                foreach (string act in actions)
                {
                    string stag = string.Format("{0}@{1}", p.GetType(), act);
                    if ((Properties.Settings.Default.Startup == null || !Properties.Settings.Default.Startup.Contains(stag)))
                    {
                        string[] parts = act.Split(new char[] { '@' });
                        ListViewItem lvi = new ListViewItem(new string[] { p.GetType().ToString(), Utils.LanguageSupport.Instance.GetTranslation(parts[0]), parts.Length == 1 ? "" : Utils.LanguageSupport.Instance.GetTranslation(parts[1]), "" });
                        lvi.Tag = stag;
                        lvi.Checked = false;
                        listView1.Items.Add(lvi);
                    }
                }
            }
            ListViewColumnSorter lvs = new ListViewColumnSorter();            
            listView1.ListViewItemSorter = lvs;
            listView1.Sort();
        }
Пример #5
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;
                }
            }
            
        }
Пример #6
0
 public static Framework.Interfaces.IPlugin PluginByName(Framework.Interfaces.ICore core, string pluginName)
 {
     List<Framework.Interfaces.IPlugin> pins = core.GetPlugins();
     return (from a in pins where a.GetType().ToString().ToLower() == pluginName.ToLower() select a).FirstOrDefault();
 }
Пример #7
0
        public FormSettingsTreeView(Framework.Interfaces.ICore core, Utils.BasePlugin.Plugin ownerPlugin)
            : this()
        {
            this.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.groupBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_GCCOMACCOUNT);
            this.buttonAuthorize.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_AUTHORIZE);
            this.groupBox2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_INTERNALSTORAGE);
            this.buttonApply.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_APPLY);
            this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NAME);
            this.label2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_API);
            this.label3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MENBERSHIP);
            this.checkBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_LOADINBACKGROUND);
            this.checkBox2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_AUTOSAVEONCLOSE);
            this.button1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CLEARAUTHORIZE);
            this.groupBox3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_OTHERACCOUNTNAMES);
            this.listView1.Columns[0].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CODEPREFIX);
            this.listView1.Columns[1].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ACCOUNTNAME);
            this.label7.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CODEPREFIX);
            this.label8.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ACCOUNTNAME);
            this.checkBox3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SHOWOKAPIMENU);

            TreeNode tn;
            tn = new TreeNode(Utils.LanguageSupport.Instance.GetTranslation(STR_GENERAL));
            tn.Tag = panelGeneral;
            treeView1.Nodes.Add(tn);

            foreach (var t in Enum.GetNames(typeof(Framework.PluginType)))
            {
                tn = new TreeNode(Utils.LanguageSupport.Instance.GetTranslation(PluginTypeToString(t)));
                tn.Tag = (Framework.PluginType)Enum.Parse(typeof(Framework.PluginType), t);
                treeView1.Nodes.Add(tn);
            }

            _core = core;
            _ownerPlugin = ownerPlugin;
            _pluginList = core.GetPlugins();
            List<string> allPlugins = core.GetAllDetectedPlugins();
            checkedListBoxPlugins.Items.AddRange(allPlugins.ToArray());
            foreach (Framework.Interfaces.IPlugin p in _pluginList)
            {
                int index = checkedListBoxPlugins.Items.IndexOf(p.GetType().FullName);
                if (index >= 0)
                {
                    checkedListBoxPlugins.SetItemChecked(index, true);
                }
                List<UserControl> pnls = p.CreateConfigurationPanels();
                if (pnls != null && pnls.Count > 0)
                {
                    _ucList.AddRange(pnls.ToArray());
                    int yPos = 0;
                    foreach (UserControl uc in pnls)
                    {
                        uc.Location = new Point(0, yPos);
                        yPos += uc.Height;
                        uc.Visible = false;
                        splitContainer1.Panel2.Controls.Add(uc);
                    }                    

                    foreach (TreeNode t in treeView1.Nodes)
                    {
                        if (t.Tag!=null && t.Tag.GetType()==typeof( Framework.PluginType))
                        {
                            if ((Framework.PluginType)t.Tag == p.PluginType)
                            {
                                tn = new TreeNode(Utils.LanguageSupport.Instance.GetTranslation(p.FriendlyName));
                                tn.Tag = pnls;
                                t.Nodes.Add(tn);
                                break;
                            }
                        }
                    }
                }
            }
            //delete the plugin nodes with no childs (settings)
            int i = 1;
            while ( i < treeView1.Nodes.Count)
            {
                TreeNode t = treeView1.Nodes[i];
                if (t.Tag != null && t.Tag.GetType() == typeof(Framework.PluginType))
                {
                    if (t.Nodes.Count == 0)
                    {
                        treeView1.Nodes.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }
            }

            treeView1.ExpandAll();
            treeView1.SelectedNode = treeView1.Nodes[0];

            comboBoxInternalStorage.Items.AddRange(core.GetAvailableInternalStoragePlugins().ToArray());
            comboBoxInternalStorage.SelectedItem = core.ActiveInternalStoragePlugin;
            textBoxUsername.Text = core.GeocachingComAccount.AccountName;
            labelApiEnabled.Text = string.IsNullOrEmpty(core.GeocachingComAccount.APIToken) ? Utils.LanguageSupport.Instance.GetTranslation(STR_NO) : Utils.LanguageSupport.Instance.GetTranslation(STR_YES);
            labelApiMembership.Text = string.IsNullOrEmpty(core.GeocachingComAccount.MemberType) ? "-" : core.GeocachingComAccount.MemberType;
            checkBox1.Checked = core.LoadLogsInBackground;
            checkBox2.Checked = core.AutoSaveOnClose;
            checkBox3.Checked = Properties.Settings.Default.ShowOKAPIMenu; ;

            fillGeocacheAccounts();
        }
Пример #8
0
        private FormProgressHandler(Framework.Interfaces.ICore core, Form owner)
        {
            _owner = owner;
            _context = SynchronizationContext.Current;
            if (_context == null)
            {
                _context = new SynchronizationContext();
            }

            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);
            }
            core.PluginAdded += new Framework.EventArguments.PluginEventHandler(core_PluginAdded);
        }