예제 #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Object[] passedParameter = e.Parameter as Object[];

            String             sres = passedParameter[0] as String;
            List <Struct_Room> list = finder.dataToList(sres);

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

            int pos = 0;


            foreach (Struct_Room item in list)
            {
                DItem_Rooms xi = new DItem_Rooms();
                xi.building = "Gebäude " + item.building;
                xi.room     = item.name;
                xi.places   = item.cap + " Plätze";
                xi.time     = item.time;
                xi.margin   = "0,0,0,0";
                xi.vis      = "Visible";
                xi.fcolor   = "#00000";
                xi.vis2     = "Collapsed";

                if (pos == 0)
                {
                    DItem_Rooms xi2 = new DItem_Rooms();
                    xi2.building = "Gebäude " + item.building;
                    xi2.room     = "";
                    xi2.places   = "";
                    xi2.time     = "";
                    xi2.margin   = "0,0,0,0";
                    xi2.color    = "#f44336";
                    xi2.vis      = "Collapsed";
                    xi2.vis2     = "Visible";
                    xi2.fcolor   = "#FFFFFF";
                    Display.Items.Add(xi2);
                }

                else if (item.building.Substring(0, 1) != list[pos - 1].building.Substring(0, 1))
                {
                    DItem_Rooms xi2 = new DItem_Rooms();
                    xi2.building = "Gebäude " + item.building;
                    xi2.room     = "";
                    xi2.places   = "";
                    xi2.time     = "";
                    xi2.color    = "#f44336";
                    xi2.fcolor   = "#FFFFFF";
                    xi2.margin   = "0,0,0,0";
                    xi2.vis      = "Collapsed";
                    xi2.vis2     = "Visible";
                    Display.Items.Add(xi2);
                }

                pos++;

                Display.Items.Add(xi);
            }
        }
예제 #2
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

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


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

            SetSupportActionBar(toolbar);
            this.SupportActionBar.SetHomeButtonEnabled(true);
            this.SupportActionBar.SetDisplayHomeAsUpEnabled(true);


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

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


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

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

            Rooms_Finder rf   = new Rooms_Finder();
            string       text = Intent.GetStringExtra("Data") ?? "Data not available";

            List <Campus_Harburg_Core.Struct_Room> list;

            try
            {
                list = rf.dataToList(text);
            }
            catch (Exception ex)
            {
                list = new List <Struct_Room>();


                Struct_Room msg = new Struct_Room();
                msg.building = "Fehler";
                msg.name     = "Während der Verarbeitung der Daten ist leider ein Fehler aufgetreten!";
                msg.time     = ex.Message;
                list.Add(msg);
            }

            list.Sort((s1, s2) => s1.building.CompareTo(s2.building));
            listView = FindViewById <ListView>(Resource.Id.List);

            listView.Adapter    = new ListAdapter_Rooms(this, list);
            listView.ItemClick += OnListItemClick;
        }