public void add(Data v1) { InvokeOnMainThread (new NSAction (delegate { try { ili.ForEach (delegate (Igno curr) { if (curr.Fach == v1.AltFach && curr.Lehrer == v1.Lehrer) throw new Exception(); }); spinnner.StopAnimating (); ti.Add (v1); List<Data> _ti = ti; if (_ti.Count == 0) { _ti.Add(new Data()); } TableView.Source = new TableSource (_ti); TableView.ReloadData(); TableView.AwakeFromNib(); } catch {} })); }
public void CustomAdd(Data d) { tableItems.Insert (tableItems.Count, d); }
private void timesNext_DownloadStringCompleted(object send, DownloadStringCompletedEventArgs e) { try { if (e.Error != null) return; //TO-DO: Parse VPlan int stringcnt = 5; string comp = e.Result; comp = comp.Replace(" ", string.Empty); string haystack = comp; string needle = "NachrichtenzumTag"; int needleCount = (haystack.Length - comp.Replace (needle, "").Length) / needle.Length; stringcnt = stringcnt + needleCount; string[] raw = new string[stringcnt]; for (int i = 0; i < stringcnt; i++) { raw[i] = comp.Substring(comp.IndexOf("<table"), comp.IndexOf("</table>") - comp.IndexOf("<table") + 8); comp = comp.Substring(comp.IndexOf("</table>") + 8); } int iOuter = 0; int daysRec = 0; foreach (var item in raw) { string it = item; if (item.IndexOf("freigegeben") == -1 && daysRec == 0) { daysRec++; it = item.Replace(" ", String.Empty); Regex regex = new Regex("<t{1}d{1}.*?>.*?</td>"); MatchCollection mc; if (item.IndexOf("KeineVertretungen") == -1) { int i = 0; while (it.IndexOf("<trclass='list") != -1) { if (i == 0) it = it.Substring(it.IndexOf("</tr>") + 5, it.Length - it.IndexOf("</tr>") - 5); string w; Data data = new Data(); w = it.Substring(it.IndexOf("<trclass='list")); w = w.Substring(0, w.IndexOf("</tr>")); it = it.Substring(it.IndexOf("</tr>") + 5, it.Length - it.IndexOf("</tr>") - 5); mc = regex.Matches(w); int iInner = 0; foreach (var thing in mc) { string thingy = thing.ToString(); thingy = thingy.Substring(thingy.IndexOf(">") + 1, thingy.Length - thingy.IndexOf(">") - 1); thingy = thingy.Substring(0, thingy.IndexOf("<")); switch (iInner) { case 0: if (thingy == "Veranst.") { data.Veranstaltung = true; } break; case 1: if (i == 0) { int day = Convert.ToInt16(thingy.Substring(0, thingy.IndexOf("."))); string dayStr = thingy.Substring(thingy.IndexOf(".") + 1); dayStr = dayStr.Replace(".", string.Empty); int month = Convert.ToInt16(dayStr); int year = DateTime.Now.Year; DateTime dt = new DateTime(year, month, day); mp.add(new Data(dt)); } break; case 2: data.Stunde = thingy; break; case 3: data.Vertreter = thingy; break; case 4: data.Fach = thingy; break; case 5: data.AltFach = thingy; break; case 6: data.Raum = thingy; break; case 7: data.Klasse = thingy; break; case 8: data.Lehrer = thingy; break; case 13: data.Notiz = thingy; break; case 14: data.EntfallStr = thingy; break; case 15: data.MitbeStr = thingy; break; default: break; } iInner++; } data.refresh(); mp.add(data); i++; } } } iOuter++; } } catch { if (mp != null) { mp.toast ("Da ist was mächtig schiefgegangen."); } else { sp.toast ("Da ist was mächtig schiefgegangen."); } } }