Ejemplo n.º 1
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            House1  house1testFragment = new House1(houseId);
            Agent   agenttestFragment  = new Agent(agentId);
            Profile protestFragment    = new Profile(userId);


            FrameLayout         fragCon = FindViewById <FrameLayout>(Resource.Id.fragContainer);
            FragmentTransaction transaction;

            switch (item.ItemId)
            {
            case Resource.Id.navigation_home:
                fragCon.RemoveAllViewsInLayout();
                fragCon.RemoveViews(0, fragCon.ChildCount);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, house1testFragment);
                transaction.AddToBackStack("house");
                transaction.Commit();
                return(true);

            case Resource.Id.navigation_agent:
                fragCon.RemoveAllViewsInLayout();
                fragCon.RemoveViews(0, fragCon.ChildCount);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, agenttestFragment);
                transaction.AddToBackStack("agent");
                transaction.Commit();
                return(true);

            case Resource.Id.navigation_profile:
                fragCon.RemoveAllViewsInLayout();
                fragCon.RemoveViews(0, fragCon.ChildCount);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, protestFragment);
                transaction.AddToBackStack("user");
                transaction.Commit();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            TextView            tvNavigationText = FindViewById <TextView>(Resource.Id.tvNavigationText);
            FrameLayout         content_frame    = FindViewById <FrameLayout>(Resource.Id.content_frame);
            FragmentTransaction transaction;

            switch (item.ItemId)
            {
            case Resource.Id.customer_profile:
                tvNavigationText.Text = "customer_profile Clicked";
                ProfileActivity Text = new ProfileActivity();
                content_frame.RemoveAllViewsInLayout();
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.content_frame, Text, "customerprofile");
                transaction.AddToBackStack("customer_profile");
                transaction.Commit();
                return(true);

            case Resource.Id.action_location:
                AgentFragment mFrag = new AgentFragment();
                content_frame.RemoveAllViewsInLayout();

                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.content_frame, mFrag, "Location");
                transaction.AddToBackStack("Location");
                transaction.Commit();
                tvNavigationText.Text = "Location Clicked";
                return(true);

            case Resource.Id.logout:
                content_frame.RemoveAllViewsInLayout();
                tvNavigationText.Text = "logout Clicked";
                return(true);
            }
            return(false);
        }
        void NavigationView_NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e)
        {
            e.MenuItem.SetChecked(true);
            View view = null;

            Detail.RemoveAllViewsInLayout();

            if (e.MenuItem.ItemId == NaviMenu.GetItem(0).ItemId) //Home
            {
                view = LayoutInflater.Inflate(Resource.Layout.Home, null);
                Detail.AddView(view);
            }
            else if (e.MenuItem.ItemId >= 0 && e.MenuItem.ItemId < AbilityMenuItemOffset)
            {
                view = LayoutInflater.Inflate(Resource.Layout.Champion, null);
                Detail.AddView(view);
                SetChampionValues(e.MenuItem);
            }

            MenuView.CloseDrawers();
        }
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            TestFragment testFragment = new TestFragment();

            FrameLayout         fragCon = FindViewById <FrameLayout>(Resource.Id.fragContainer);
            FragmentTransaction transaction;

            switch (item.ItemId)
            {
            case Resource.Id.navigation_home:
                textMessage.SetText(Resource.String.title_home);
                fragCon.RemoveAllViewsInLayout();
                fragCon.RemoveViews(0, fragCon.ChildCount);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, testFragment, "Home");
                transaction.AddToBackStack("Home");
                transaction.Commit();

                return(true);

            case Resource.Id.navigation_dashboard:
                textMessage.SetText(Resource.String.title_dashboard);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, testFragment, "Dashboard");
                transaction.AddToBackStack("Dashboard");
                transaction.Commit();
                return(true);

            case Resource.Id.navigation_notifications:
                textMessage.SetText(Resource.String.title_notifications);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, testFragment, "Notifications");
                transaction.AddToBackStack("Dashboard");
                transaction.Commit();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 5
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            houseFragment houseFragment = new houseFragment();

            FrameLayout         fragCon = FindViewById <FrameLayout>(Resource.Id.fragContainer);
            FragmentTransaction transaction;

            switch (item.ItemId)
            {
            case Resource.Id.navigation_House:
                textMessage.SetText(Resource.String.title_House);
                fragCon.RemoveAllViewsInLayout();
                fragCon.RemoveViews(0, fragCon.ChildCount);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, houseFragment, "Home");
                transaction.AddToBackStack("Home");
                transaction.Commit();

                return(true);

            case Resource.Id.navigation_agent:
                textMessage.SetText(Resource.String.title_agent);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, houseFragment, "agent");
                transaction.AddToBackStack("agent");
                transaction.Commit();
                return(true);

            case Resource.Id.navigation_User:
                textMessage.SetText(Resource.String.title_User);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, houseFragment, "User");
                transaction.AddToBackStack("User");
                transaction.Commit();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            FrameLayout navFragContainer = FindViewById <FrameLayout>(Resource.Id.navFragContainer);
            Bundle      data             = Intent.GetBundleExtra("data");


            switch (item.ItemId)
            {
            case Resource.Id.menu1:

                HousedetailFragment sFrag = new HousedetailFragment(hList, hagency);
                sFrag.getph(data.GetInt("photoid"));
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.navFragContainer, sFrag, "Hd");
                //transaction.AddToBackStack("Hd");
                transaction.Commit();

                return(true);

            case Resource.Id.menu2:

                navFragContainer.RemoveAllViewsInLayout();



                AgencydetailFragment aFrag = new AgencydetailFragment(agencies, hList, data.GetString("uname"), data.GetString("uphone"), data.GetString("hlocation"));



                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.navFragContainer, aFrag, "Ad");
                transaction.Commit();

                return(true);
            }
            return(false);
        }
Ejemplo n.º 7
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            FrameLayout         navFragContainer = FindViewById <FrameLayout>(Resource.Id.navFragContainer);
            FragmentTransaction transaction;
            Bundle data = Intent.GetBundleExtra("data");
            Bundle user = Intent.GetBundleExtra("user");
            int    id   = user.GetInt("id");


            switch (item.ItemId)
            {
            case Resource.Id.menu1:


                navFragContainer.RemoveAllViewsInLayout();

                HousedetailFragment sFrag = new HousedetailFragment(heading, numberofroom, numberoftoilet, rentfee, location, agencyname, description);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.navFragContainer, sFrag);
                transaction.Commit();

                return(true);

            //call the agency number

            /* bool status = false;
             * string url = "https://10.0.2.2:5001/api/Agency";
             * string response = APIConnect.Get(url);
             * List<Agency> agencies = JsonConvert.DeserializeObject<List<Agency>>(response);
             *
             *
             * foreach (Agency agency in agencies)
             * {
             *   if (agency.agencyname == data.GetString("agencyname"))
             *   {
             *       //need to call user name
             *       status = true;
             *       navFragContainer.RemoveAllViewsInLayout();
             *
             *       HousedetailFragment sFrag = new HousedetailFragment(heading, numberofroom, numberoftoilet, rentfee, location, agencyname, description,agency.agencylocation);
             *       transaction = FragmentManager.BeginTransaction();
             *       transaction.Replace(Resource.Id.navFragContainer, sFrag);
             *       transaction.Commit();
             *
             *       break;
             *   }
             * }
             *
             *
             * return true;*/



            //return true;


            case Resource.Id.menu2:

                bool          staus    = false;
                string        url      = "https://10.0.2.2:5001/api/Agencies";
                string        response = APIConnect.Get(url);
                List <Agency> agencies = JsonConvert.DeserializeObject <List <Agency> >(response);

                foreach (Agency agency in agencies)
                {
                    if (agency.agencyname == data.GetString("agencyname"))
                    {
                        navFragContainer.RemoveAllViewsInLayout();
                        AgencydetailFragment aFrag = new AgencydetailFragment(agency.agencyname, agency.agencyphonenumber, agency.agencyemail, agency.agencylocation);     //, user.GetString(""));
                        transaction = FragmentManager.BeginTransaction();
                        transaction.Replace(Resource.Id.Aname, aFrag, agency.agencyname);
                        transaction.Replace(Resource.Id.APhonenumber, aFrag, agency.agencyphonenumber);
                        transaction.Replace(Resource.Id.Aemail, aFrag, agency.agencyemail);
                        transaction.Replace(Resource.Id.Alocation, aFrag, agency.agencylocation);

                        transaction.Commit();
                        break;
                    }
                }



                return(true);

                /*
                 * //need to change users to agency (not list agency)
                 * navFragContainer.RemoveAllViewsInLayout();
                 * //sFrag = new HousedetailFragment(heading, numberofroom, numberoftoilet, rentfee, location, agencyname, description);
                 *
                 * status = false;
                 * url = "https://10.0.2.2:5001/api/Users" + "/" + id;
                 * response = APIConnect.Get(url);
                 * User ausers = JsonConvert.DeserializeObject<User>(response);
                 *
                 * status = false;
                 * url = "https://10.0.2.2:5001/api/Agency";
                 * response = APIConnect.Get(url);
                 * agencies = JsonConvert.DeserializeObject<List<Agency>>(response);
                 *
                 *
                 * foreach (Agency agency in agencies)
                 * {
                 *  if (agency.agencyname == data.GetString("agencyname")&&ausers.id == data.GetInt("id")&&agency.agencyname ==agencyname)
                 *  {
                 *      //need to call house location and
                 *      status = true;
                 *      navFragContainer.RemoveAllViewsInLayout();
                 *      AgencydetailFragment aFrag = new AgencydetailFragment(agency.agencyname, agency.agencyphonenumber, agency.agencyemail, agency.agencyphonenumber, location, ausers.name);
                 *
                 *      transaction = FragmentManager.BeginTransaction();
                 *      transaction.Replace(Resource.Id.navFragContainer, aFrag);
                 *      transaction.Commit();
                 *
                 *      break;
                 *  }
                 * }
                 * return status;
                 */
            }
            return(false);
        }