Ejemplo n.º 1
0
        public static List<AccountInfo> GetAccountInfos()
        {
            List<AccountInfo> result = new List<AccountInfo>();
            try
            {
                string xml = PluginSettings.Instance.Accounts;
                if (!string.IsNullOrEmpty(xml))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(xml);
                    XmlElement root = doc.DocumentElement;

                    XmlNodeList bmNodes = root.SelectNodes("account");
                    if (bmNodes != null)
                    {
                        foreach (XmlNode n in bmNodes)
                        {
                            AccountInfo bm = new AccountInfo();
                            bm.Name = n.SelectSingleNode("Name").InnerText;
                            bm.SwitchGeocachingComAccount = bool.Parse(n.SelectSingleNode("SwitchGeocachingComAccount").InnerText);
                            bm.SwitchDatabase = bool.Parse(n.SelectSingleNode("SwitchDatabase").InnerText);

                            XmlNode gca = n.SelectSingleNode("GeocachingComAccount");
                            if (gca != null)
                            {
                                bm.GeocachingComAccount = new Framework.Data.GeocachingComAccountInfo();
                                bm.GeocachingComAccount.AccountName = gca.SelectSingleNode("AccountName").InnerText;
                                bm.GeocachingComAccount.APIToken = gca.SelectSingleNode("APIToken").InnerText;
                                bm.GeocachingComAccount.MemberType = gca.SelectSingleNode("MemberType").InnerText;
                                bm.GeocachingComAccount.MemberTypeId = int.Parse(gca.SelectSingleNode("MemberTypeId").InnerText);
                            }

                            gca = n.SelectSingleNode("InternalStorageInfo");
                            if (gca != null)
                            {
                                bm.InternalStorageInfo = new Framework.Data.InternalStorageDestination();
                                bm.InternalStorageInfo.Name = gca.SelectSingleNode("Name").InnerText;
                                bm.InternalStorageInfo.PluginType = gca.SelectSingleNode("PluginType").InnerText;

                                XmlNodeList subs = gca.SelectNodes("StorageInfo");
                                bm.InternalStorageInfo.StorageInfo = new string[subs.Count];
                                for (int i=0; i<subs.Count; i++)
                                {
                                    bm.InternalStorageInfo.StorageInfo[i] = subs[i].InnerText;
                                }
                            }

                            result.Add(bm);
                        }
                    }
                }
            }
            catch
            {
            }
            return result;
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Length > 0)
     {
         AccountInfo ai = new AccountInfo();
         ai.Name = textBox1.Text;
         ai.SwitchDatabase = true;
         ai.SwitchGeocachingComAccount = true;
         ai.SaveSettings(_core);
         AccountInfoSettings.Add(ai);
         comboBox1.Items.Add(ai);
         comboBox1.SelectedItem = ai;
         comboBox1_SelectedIndexChanged(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 3
0
        public async override Task ApplicationInitializedAsync()
        {
            await base.ApplicationInitializedAsync();

            AddAccountsToMenu(AccountInfo.GetAccountInfos());
        }