/// <summary> /// Used to load class all at once and call the load functions /// </summary> /// <param name="main">the Activity calling</param> /// <param name="feed">the RUL of the church list</param> /// <param name="tag">debug log title</param> /// <param name="filter">filter to your song table (//SermonCasting/Church</param> internal LoadDetails(MainActivity main, string feed, string tag, string filter) { bool create = true; Main = main; _churchFeed = feed; _title = tag; //load the remote file xml = LoadRSS.GetPage(_churchFeed, filter); //was it any good? create = (xml == null) || xml.Count <= 1; //if we need to create a new file if (create) { CreateSettings(); } _church = FillCurrent(_church); ChurchDetails.Add(_church); Church = _church; _index = 0; FillSettings(); }
private void FillSettings() { //Reset to default items.Clear(); ChurchDetails.Clear(); ChurchNames = new ArrayAdapter <string>(Main, Android.Resource.Layout.SimpleListItem1, items); ChurchNames.Add(_church.Name); ChurchDetails.Add(_church); _index = 0; //This loops through the list and writes out the title and URL. for (int i = 0; i < xml.Count; i++) { ChurchItems ci = new ChurchItems(); foreach (XmlNode xl in xml[i]) { string name = xl.Attributes.GetNamedItem("name").InnerText; switch (name) { case "Title": ci.Title = xl.InnerText; break; case "Name": ci.Name = xl.InnerText; break; case "Feed": ci.Feed = xl.InnerText; break; case "Website": ci.Website = xl.InnerText; break; case "IconUrl": ci.IconUrl = xl.InnerText; break; case "BackgroundUrl": ci.BackgroundUrl = xl.InnerText; break; default: Log.Debug(LoadRSS.AppName, name + " not found, check your spelling!"); break; } } //we have the values add them ChurchDetails.Add(ci); ChurchNames.Add(ci.Name); } _index = ChurchDetails.Count; }
private ChurchItems FillCurrent(ChurchItems _church) { _church.Name = _name; _church.BackgroundUrl = _backgroundUrl; _church.Feed = _feed; _church.IconUrl = _iconUrl;; _church.Title = _title; _church.Website = _website; return(_church); }
/// <summary> /// Select active church /// </summary> /// <param name="index"></param> /// <returns></returns> internal int SetIndex(int index) { if (ChurchDetails == null || index < 0) { return(-1); } if (index > ChurchDetails.Count) { //set to default _church = ChurchDetails[0]; _index = 0; return(0); } _church = ChurchDetails[index]; _index = index; return(index); }