2017-01-31 21:22:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Android.App;
|
|
|
|
|
using Android.Content;
|
|
|
|
|
using Android.Runtime;
|
|
|
|
|
using Android.Views;
|
|
|
|
|
using Android.Widget;
|
|
|
|
|
using Android.OS;
|
|
|
|
|
using Android.Support.V4.View;
|
|
|
|
|
using Orarend;
|
2017-02-08 21:21:11 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using Android.Graphics;
|
2017-01-31 21:22:05 +00:00
|
|
|
|
|
|
|
|
|
namespace OrarendAndroidApp
|
|
|
|
|
{
|
|
|
|
|
[Activity(Label = "OrarendAndroidApp", MainLauncher = true, Icon = "@drawable/icon")]
|
|
|
|
|
public class MainActivity : Activity
|
|
|
|
|
{
|
2017-02-10 18:09:29 +00:00
|
|
|
|
private Handler handler;
|
|
|
|
|
|
2017-01-31 21:22:05 +00:00
|
|
|
|
protected override void OnCreate(Bundle bundle)
|
|
|
|
|
{
|
|
|
|
|
base.OnCreate(bundle);
|
2017-02-08 21:21:11 +00:00
|
|
|
|
SetContentView(Resource.Layout.MainLayout);
|
2017-02-10 18:09:29 +00:00
|
|
|
|
handler = new Handler();
|
2017-02-08 21:21:11 +00:00
|
|
|
|
var table = FindViewById<TableLayout>(Resource.Id.tableLayout1);
|
|
|
|
|
Action<string, Color, TableRow> addCell = (text, color, tr1) =>
|
|
|
|
|
{
|
|
|
|
|
TextView textview = new TextView(this);
|
|
|
|
|
textview.SetText(text, TextView.BufferType.Normal);
|
|
|
|
|
textview.SetTextColor(color);
|
|
|
|
|
tr1.AddView(textview);
|
|
|
|
|
};
|
2017-02-11 16:28:53 +00:00
|
|
|
|
API.Frissítés().ContinueWith(t =>
|
2017-02-09 21:28:23 +00:00
|
|
|
|
{
|
2017-02-10 18:09:29 +00:00
|
|
|
|
handler.Post(() =>
|
|
|
|
|
{
|
|
|
|
|
if (t.Exception?.InnerExceptions.Count > 0)
|
2017-02-11 16:28:53 +00:00
|
|
|
|
{
|
2017-02-10 18:09:29 +00:00
|
|
|
|
foreach (var ex in t.Exception.InnerExceptions)
|
2017-02-11 16:28:53 +00:00
|
|
|
|
{
|
|
|
|
|
TableRow tr = new TableRow(this);
|
2017-02-10 18:09:29 +00:00
|
|
|
|
addCell(ex.ToString(), Color.Red, tr);
|
2017-02-11 16:28:53 +00:00
|
|
|
|
table.AddView(tr);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-10 18:09:29 +00:00
|
|
|
|
else
|
2017-02-11 16:28:53 +00:00
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < API.AktuálisÓrarend.ÓrákAHét.GetLength(1); j++)
|
|
|
|
|
{
|
|
|
|
|
TableRow tr = new TableRow(this);
|
|
|
|
|
for (int i = 0; i < API.AktuálisÓrarend.ÓrákAHét.GetLength(0); i++)
|
|
|
|
|
addCell(API.AktuálisÓrarend.ÓrákAHét[i, j] != null ? API.AktuálisÓrarend.ÓrákAHét[i, j].Név : "", Color.Aqua, tr);
|
|
|
|
|
table.AddView(tr);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-10 18:09:29 +00:00
|
|
|
|
});
|
2017-02-11 16:28:53 +00:00
|
|
|
|
});
|
2017-01-31 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|