예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     Guid guid = getGuid();
     if (getBookmarkList(guid))
     {
         BookmarkInfo bi = new BookmarkInfo();
         bi.Name = textBox2.Text;
         bi.Guid = guid.ToString();
         bi.GeocacheCodes = _gcCodes.ToList();
         BookmarkInfoList.Instance(_core).AddBookmark(bi);
         DialogResult = System.Windows.Forms.DialogResult.OK;
         Close();
     }
 }
예제 #2
0
        private BookmarkInfoList(Framework.Interfaces.ICore core)
        {
            _bookmarkInfos = new List<BookmarkInfo>();
            _core = core;
            try
            {
                _bookmarksFile = System.IO.Path.Combine(core.PluginDataPath, "bookmarks.xml" );

                if (System.IO.File.Exists(_bookmarksFile))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(_bookmarksFile);
                    XmlElement root = doc.DocumentElement;

                    XmlNodeList bmNodes = root.SelectNodes("bookmark");
                    if (bmNodes != null)
                    {
                        foreach (XmlNode n in bmNodes)
                        {
                            BookmarkInfo bm = new BookmarkInfo();
                            bm.Guid = n.SelectSingleNode("Guid").InnerText;
                            bm.Name = n.SelectSingleNode("Name").InnerText;
                            bm.GeocacheCodes = new List<string>();
                            XmlNodeList cNodes = n.SelectSingleNode("Codes").SelectNodes("Code");
                            if (cNodes != null)
                            {
                                foreach (XmlNode c in cNodes)
                                {
                                    bm.GeocacheCodes.Add(c.InnerText);
                                }
                            }
                            _bookmarkInfos.Add(bm);
                        }
                    }
                }

            }
            catch
            {
            }
        }
예제 #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            BookmarkInfo bi = listBox1.SelectedItem as BookmarkInfo;

            if (bi != null)
            {
                if (getBookmarkList(Guid.Parse(bi.Guid)))
                {
                    bi.GeocacheCodes = _gcCodes.ToList();
                    List <string> present = (from a in _gcCodes
                                             join Framework.Data.Geocache g in _core.Geocaches on a equals g.Code
                                             select a).ToList();
                    foreach (string s in present)
                    {
                        _gcCodes.Remove(s);
                    }
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                    Close();
                }
            }
        }
예제 #4
0
        private BookmarkInfoList(Framework.Interfaces.ICore core)
        {
            _bookmarkInfos = new List<BookmarkInfo>();
            _core = core;
            try
            {
                string xml = PluginSettings.Instance.Bookmarks;
                if (!string.IsNullOrEmpty(xml))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(xml);
                    XmlElement root = doc.DocumentElement;

                    XmlNodeList bmNodes = root.SelectNodes("bookmark");
                    if (bmNodes != null)
                    {
                        foreach (XmlNode n in bmNodes)
                        {
                            BookmarkInfo bm = new BookmarkInfo();
                            bm.Guid = n.SelectSingleNode("Guid").InnerText;
                            bm.Name = n.SelectSingleNode("Name").InnerText;
                            bm.GeocacheCodes = new List<string>();
                            XmlNodeList cNodes = n.SelectSingleNode("Codes").SelectNodes("Code");
                            if (cNodes != null)
                            {
                                foreach (XmlNode c in cNodes)
                                {
                                    bm.GeocacheCodes.Add(c.InnerText);
                                }
                            }
                            _bookmarkInfos.Add(bm);
                        }
                    }
                }

            }
            catch
            {
            }
        }
예제 #5
0
        private BookmarkInfoList(Framework.Interfaces.ICore core)
        {
            _bookmarkInfos = new List <BookmarkInfo>();
            _core          = core;
            try
            {
                string xml = PluginSettings.Instance.Bookmarks;
                if (!string.IsNullOrEmpty(xml))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(xml);
                    XmlElement root = doc.DocumentElement;

                    XmlNodeList bmNodes = root.SelectNodes("bookmark");
                    if (bmNodes != null)
                    {
                        foreach (XmlNode n in bmNodes)
                        {
                            BookmarkInfo bm = new BookmarkInfo();
                            bm.Guid          = n.SelectSingleNode("Guid").InnerText;
                            bm.Name          = n.SelectSingleNode("Name").InnerText;
                            bm.GeocacheCodes = new List <string>();
                            XmlNodeList cNodes = n.SelectSingleNode("Codes").SelectNodes("Code");
                            if (cNodes != null)
                            {
                                foreach (XmlNode c in cNodes)
                                {
                                    bm.GeocacheCodes.Add(c.InnerText);
                                }
                            }
                            _bookmarkInfos.Add(bm);
                        }
                    }
                }
            }
            catch
            {
            }
        }
예제 #6
0
 public void BookmarkRemoved(BookmarkInfo bi)
 {
     RemoveAction(string.Format("{0}|{1}", ACTION_BOOKMARK, bi.Name.Replace('|', ' ')));
 }
예제 #7
0
 public void BookmarkAdded(BookmarkInfo bi)
 {
     AddAction(string.Format("{0}|{1}", ACTION_BOOKMARK, bi.Name.Replace('|', ' ')));
     Framework.Interfaces.IPluginUIMainWindow main = (from Framework.Interfaces.IPluginUIMainWindow a in Core.GetPlugin(Framework.PluginType.UIMainWindow) select a).FirstOrDefault();
     main.AddAction(this, ACTION_BOOKMARK, bi.Name.Replace('|', ' '));
 }
예제 #8
0
        private void button5_Click(object sender, EventArgs e)
        {
            Guid guid = getGuid();
            if (getBookmarkList(guid))
            {
                BookmarkInfo bi = new BookmarkInfo();
                bi.Name = textBox2.Text;
                bi.Guid = guid.ToString();
                bi.GeocacheCodes = _gcCodes.ToList();
                BookmarkInfoList.Instance(_core).AddBookmark(bi);

                bi.GeocacheCodes = _gcCodes.ToList();
                List<string> present = (from a in _gcCodes
                                        join Framework.Data.Geocache g in _core.Geocaches on a equals g.Code
                                        select a).ToList();
                foreach (string s in present)
                {
                    _gcCodes.Remove(s);
                }

                DialogResult = System.Windows.Forms.DialogResult.OK;
                Close();
            }
        }
예제 #9
0
 public void RemoveBookmark(BookmarkInfo bm)
 {
     _bookmarkInfos.Remove(bm);
     saveBookmarks();
     if (SelectGeocachesPlugin != null)
     {
         SelectGeocachesPlugin.BookmarkRemoved(bm);
     }
 }
예제 #10
0
 public void AddBookmark(BookmarkInfo bm)
 {
     _bookmarkInfos.Add(bm);
     saveBookmarks();
     if (SelectGeocachesPlugin != null)
     {
         SelectGeocachesPlugin.BookmarkAdded(bm);
     }
 }
예제 #11
0
 public void BookmarkRemoved(BookmarkInfo bi)
 {
     RemoveAction(string.Format("{0}|{1}", ACTION_BOOKMARK, bi.Name.Replace('|', ' ')));
 }
예제 #12
0
 public void BookmarkAdded(BookmarkInfo bi)
 {
     AddAction(string.Format("{0}|{1}", ACTION_BOOKMARK, bi.Name.Replace('|', ' ')));
     Framework.Interfaces.IPluginUIMainWindow main = (from Framework.Interfaces.IPluginUIMainWindow a in Core.GetPlugin(Framework.PluginType.UIMainWindow) select a).FirstOrDefault();
     main.AddAction(this, ACTION_BOOKMARK, bi.Name.Replace('|', ' '));
 }