Beispiel #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetTheme(Resource.Style.MyTheme);
            Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);

            SetContentView(Resource.Layout.Form_Exams);
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);


            toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            Android.Support.V7.App.ActionBar actionBar = this.SupportActionBar;


            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
            navigationView.SetCheckedItem(Resource.Id.nav_exams);


            var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);

            drawerLayout.SetDrawerListener(drawerToggle);
            drawerToggle.SyncState();

            listView = FindViewById <ListView>(Resource.Id.List);

            Campus_Harburg_Core.Exams_Item xi = new Campus_Harburg_Core.Exams_Item();
            xi.Name = "Laden...";
            xi.Note = "Daten werden verarbeitet";
            xi.Time = "";

            Campus_Harburg_Core.Exams_P exa = new Campus_Harburg_Core.Exams_P();

            ep.init(fio);

            Exams_Collection exi = ep.getDisplayList();

            exi.list.Sort((s1, s2) => s1.Name.CompareTo(s2.Name));

            tableItems.Add(xi);

            listView.Adapter = new ListAdapter_Exams(this, exi.list);



            int dayDif = (DateTime.Now - exi.list_time_download).Days;

            if (dayDif >= 30 && exi.list.Count >= 2)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("Info");
                alert.SetMessage(TextContainer.Exams_TooOld);


                alert.SetPositiveButton("Ja", (senderAlert, args) =>
                {
                    update();
                });
                alert.SetNegativeButton("Nein", (senderAlert, args) =>
                {
                });

                Dialog dialog = alert.Create();
                dialog.Show();
            }
            else if (exi.list.Count < 2)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("Info");
                alert.SetMessage(TextContainer.Exams_Empty);

                alert.SetPositiveButton("Ja", (senderAlert, args) =>
                {
                    update();
                });
                alert.SetNegativeButton("Nein", (senderAlert, args) =>
                {
                });

                Dialog dialog = alert.Create();
                dialog.Show();
            }
        }