예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.register_page_layout);

            if (savedInstanceState != null)
            {
                _registerFragment = (RegisterFragment)SupportFragmentManager.FindFragmentById(Resource.Id.register_fragment_layout);
            }

            if (_registerFragment == null)
            {
                _registerFragment = RegisterFragment.NewInstance();
                ReplaceFragment(_registerFragment);
            }
            // Create your application here
        }
        private void ListItemClicked(int position)
        {
            //this way we don't load twice, but you might want to modify this a bit.
            if (position == oldPosition)
            {
                return;
            }

            oldPosition = position;

            Fragment fragment = null;

            switch (position)
            {
            case 0:
                fragment = HomeFragment.NewInstance();
                break;

            case 1:
                fragment = RestaurantIndexFragment.NewInstance();
                break;

            case 2:
                fragment = MenuIndexFragment.NewInstance();
                break;

            case 3:
                fragment = LoginFragment.NewInstance();
                break;

            case 4:
                fragment = RegisterFragment.NewInstance();
                break;

            case 5:
                fragment = UserDetailsFragment.NewInstance();
                break;

            case 6:
                fragment = BookingIndexFragment.NewInstance();
                break;

            case 7:
                new Android.App.AlertDialog.Builder(this).
                SetIcon(Android.Resource.Drawable.IcDialogAlert).
                SetTitle("Confirm").
                SetMessage("Are you sure you want to logout?").
                SetPositiveButton("Yes", (c, ev) =>
                {
                    GenericFacade.Token    = "";
                    GenericFacade.UserName = "";
                    GenericFacade.UserId   = 0;
                    ToggleLogout();
                }).
                SetNegativeButton("No", (c, ev) =>
                {
                }).
                Show();
                break;

            case 8:
                ExitApp();
                break;
            }

            if (fragment != null)
            {
                FragmentManager.BeginTransaction()
                .Replace(Resource.Id.content_frame, fragment)
                .Commit();
            }
        }