示例#1
0
        void LstVwMenu_ItemSelected(object sender, AdapterView.ItemClickEventArgs e)
        {
            switch (e.Position)
            {
            case 0:
                var fragment = new Fragments.bootRausFrag();
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, fragment).Commit();
                break;

            case 1:
                var fragment1 = new Fragments.aktuellFrag();
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, fragment1).Commit();
                break;

            case 2:
                var fragment2 = new Fragments.verlaufFrag();
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, fragment2).Commit();
                break;

            case 3:
                var fragment3 = new Fragments.logoutFrag();
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, fragment3).Commit();
                break;
            }

            drawerLayout.CloseDrawers();
        }
示例#2
0
        public override bool OnContextItemSelected(IMenuItem item)
        {
            var info      = (AdapterView.AdapterContextMenuInfo)item.MenuInfo;
            var menuIndex = item.ItemId;
            var db        = new SQLiteConnection(dbPathDef);
            var dbDa      = new SQLiteConnection(dbPathEnde);

            if (menuIndex == 0)
            {
                Boot bootDa    = booteUsedClass[info.Position];
                int  index     = helperList.FindIndex(x => x == bootDa);
                var  bootSkrrt = db.Table <Boot>().ElementAt(index);
                Toast.MakeText(Context, bootSkrrt.Nummer + " gelöscht!", ToastLength.Short).Show();
                bootSkrrt.Available = true;
                db.InsertOrReplace(bootSkrrt, typeof(Boot));
                db.Commit();
                db.Close();
                dbDa.Close();
                booteUsed.RemoveAt(info.Position);
                booteUsedClass.RemoveAt(info.Position);
                lstVwBooteAktuell.DeferNotifyDataSetChanged();
                var frag = new bootRausFrag();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, frag).CommitNow();
            }
            else if (menuIndex == 1)
            {
                Boot bootDa = booteUsedClass[info.Position];
                //Toast.MakeText(Context, bootDa.FullInfo(), ToastLength.Short).Show();
                int index = helperList.FindIndex(x => x.ID == bootDa.ID);
                //Toast.MakeText(Context, index.ToString(), ToastLength.Short).Show();
                var bootSkkrt = db.Table <Boot>().ElementAt(index);
                Toast.MakeText(Context, bootSkkrt.Nummer + " ist wieder da!", ToastLength.Short).Show();
                bootSkkrt.Available = true;
                bootSkkrt.endZeit   = DateTime.Now;
                dbDa.Insert(bootSkkrt);
                db.Table <Boot>().Delete(x => x.Nummer == bootSkkrt.Nummer);
                db.Insert(bootSkkrt);
                dbDa.Commit();
                db.Commit();
                dbDa.Close();
                db.Close();
                booteUsed.RemoveAt(info.Position);
                booteUsedClass.RemoveAt(info.Position);
                lstVwBooteAktuell.DeferNotifyDataSetChanged();
                var frag = new bootRausFrag();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, frag).CommitNow();
            }
            return(true);
        }