Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Napominanie);
            // Create your application here

            mToolbar      = FindViewById <SupportToolbar>(Resource.Id.toolBar1);
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.Drawer_layout1);
            mLeftDrawer   = FindViewById <ListView>(Resource.Id.left_drawer1);
            listView      = FindViewById <ListView>(Resource.Id.listView1);
            SetSupportActionBar(mToolbar);

            mLeftDataSet = new List <string>();
            mLeftDataSet.Add("Расписание");
            // mLeftDataSet.Add("Преподаватели");
            mLeftDataSet.Add("Напоминание");
            //mLeftDataSet.Add("Местоположение");
            mLeftDataSet.Add("Выход");
            mLeftAdapter        = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet);
            mLeftDrawer.Adapter = mLeftAdapter;
            mDrawerToggle       = new MyActionBarDrawerToggle(
                this,                        //host activity
                mDrawerLayout,               //DrawerLayout
                Resource.String.naponinanie, //открыто сообщение
                Resource.String.naponinanie  //зактрыто сообщение
                );
            mLeftDrawer.ItemClick += mLeftDrawer_ItemClick;

            Create_Database dbr = new Create_Database();
            var             res = dbr.GetAllRecords();

            if (res != "")
            {
                string[] str = res.Split('\n');
                for (int i = 0; i < str.Length - 1; i++)
                {
                    string   str2 = "";
                    string[] str1 = str[i].Split(' ');
                    for (int j = 3; j < str1.Length; j++)
                    {
                        str2 += str1[j] + " ";
                    }
                    tableItems.Add(new TableItem()
                    {
                        Heading = str1[1] + " " + str1[2], SubHeading = str2
                    });
                }
                listView.Adapter = new HomeScreenAdapter(this, tableItems);
            }

            listView.ItemClick     += listView_ItemClick;
            listView.ItemLongClick += listView_ItemLongClick;


            mDrawerLayout.SetDrawerListener(mDrawerToggle);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            mDrawerToggle.SyncState();
        }
Пример #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.user);
            // Create your application here

            mToolbar      = FindViewById <SupportToolbar>(Resource.Id.toolBar);
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.Drawer_layout);
            mLeftDrawer   = FindViewById <ListView>(Resource.Id.left_drawer);

            SetSupportActionBar(mToolbar);
            var trans = SupportFragmentManager.BeginTransaction();
            SlidingTabsFragment fragment = new SlidingTabsFragment();

            trans.Add(Resource.Id.sample_content_fragment, fragment);
            trans.Commit();



            mLeftDataSet = new List <string>();
            mLeftDataSet.Add("Расписание");
            //mLeftDataSet.Add("Преподаватели");
            mLeftDataSet.Add("Напоминание");
            // mLeftDataSet.Add("Местоположение");
            mLeftDataSet.Add("Выход");
            mLeftAdapter        = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet);
            mLeftDrawer.Adapter = mLeftAdapter;
            mDrawerToggle       = new MyActionBarDrawerToggle(
                this,                       //host activity
                mDrawerLayout,              //DrawerLayout
                Resource.String.raspisanie, //открыто сообщение
                Resource.String.raspisanie  //зактрыто сообщение
                );

            mLeftDrawer.ItemClick += mLeftDrawer_ItemClick;

            mDrawerLayout.SetDrawerListener(mDrawerToggle);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            mDrawerToggle.SyncState();
            //////////////
            FIO       = Intent.GetStringExtra("fio");
            ID_gruppi = Intent.GetIntExtra("id_gruppi", 1);
            student1 ts = new student1();

            ts.ID_GRUPPI(ID_gruppi);
            if (student1.flag == 0)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetMessage("Здравствуйте " + FIO);
                Dialog dialog = alert.Create();
                dialog.Show();
                student1.flag++;
            }
        }