コード例 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.NavLayout);

            main_btn_logout = FindViewById <ImageButton>(Resource.Id.main_btn_Logout);
            mTxtViewSignout = FindViewById <TextView>(Resource.Id.textSignout);
            BottomNavigationView navigation = FindViewById <BottomNavigationView>(Resource.Id.navigation);

            navigation.SetOnNavigationItemSelectedListener(this);
            if (this.Intent.GetStringExtra("UserName") != "" || this.Intent.GetStringExtra("UserName") != null)
            {
                mTxtViewSignout.Text = this.Intent.GetStringExtra("UserName");
            }
            else
            {
                mTxtViewSignout.Text = "Invalid login";
            }
            main_btn_logout.Click += Main_btn_logout_Click;

            FlightBookFragment flightBook = new FlightBookFragment();

            transaction = this.FragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container, flightBook);
            transaction.Commit();
        }
コード例 #2
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.navigation_flight:
                FlightBookFragment flightBook = new FlightBookFragment();
                transaction = this.FragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container, flightBook);
                transaction.Commit();
                return(true);

            case Resource.Id.navigation_dashboard:
                DashboardFragment dashboard = new DashboardFragment();
                transaction = this.FragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container, dashboard);
                transaction.Commit();
                return(true);

            case Resource.Id.navigation_car:
                CarhireFragment carhire = new CarhireFragment();
                transaction = this.FragmentManager.BeginTransaction().Replace(Resource.Id.fragment_container, carhire);
                transaction.Commit();
                return(true);
            }
            return(false);
        }