Esempio n. 1
0
        void OnNavigationViewItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e)
        {
            Fragment fragment = null;

            switch (e.MenuItem.ItemId)
            {
            case Resource.Id.nav_dashboard:
                fragment = DashboardFragment.NewInstance(_employeeService, onEmployeeTypeSelected, onReviewTileSelected);
                break;

            case Resource.Id.my_profile:
                fragment = new UserProfileFragment();
                break;

            case Resource.Id.nav_logout:
                ShowLogOutConfirmationDialog();
                break;
            }

            if (fragment != null)
            {
                ReplaceFragment(fragment);
            }

            _drawer.CloseDrawer(GravityCompat.Start);
        }
Esempio n. 2
0
        public static void OpenProfile(Activity activity, string userId, UserDataObject item)
        {
            try
            {
                if (userId != UserDetails.UserId)
                {
                    Bundle bundle = new Bundle();
                    bundle.PutString("userinfo", JsonConvert.SerializeObject(item));
                    bundle.PutString("type", "UserData");
                    bundle.PutString("userid", userId);
                    bundle.PutString("avatar", item.Avatar);
                    bundle.PutString("fullname", item.Username);
                    if (AppSettings.ProfileTheme == ProfileTheme.DefaultTheme)
                    {
                        UserProfileFragment profileFragment = new UserProfileFragment
                        {
                            Arguments = bundle
                        };

                        HomeActivity.GetInstance()?.OpenFragment(profileFragment);
                    }
                    else if (AppSettings.ProfileTheme == ProfileTheme.TikTheme)
                    {
                        TikUserProfileFragment profileFragment = new TikUserProfileFragment
                        {
                            Arguments = bundle
                        };
                        HomeActivity.GetInstance()?.OpenFragment(profileFragment);
                    }
                }
                else
                {
                    HomeActivity.GetInstance()?.NavigationTabBar.SetModelIndex(4, true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 3
0
        private void ListItemClicked(int position)
        {
            try
            {
                _editItemVisible    = false;
                _requestItemVisible = false;
                //this way we don't load twice, but you might want to modify this a bit.
                if (position == _oldPosition) //perhaps allow loading of homepage again???
                {
                    return;
                }

                _oldPosition = position;
                Android.Support.V4.App.Fragment interfaceFragment = null;
                switch (position)
                {
                case 0:     //Home page
                    //interfaceFragment = HomePageFragment.NewInstance();
                    interfaceFragment = HomePageFragment.NewInstance();
                    _viewTitle        = "Auto Folio";
                    break;

                case 1:     //My Profile
                    interfaceFragment = UserProfileFragment.NewInstance();
                    //interfaceFragment = TestLayoutFragment.NewInstance();
                    interfaceFragment.Arguments = _dataBundle;
                    _viewTitle       = "My Profile";
                    _editItemVisible = true;
                    break;

                case 2:     //MY Inventory
                    interfaceFragment           = UserInventoryFragment.NewInstance();
                    interfaceFragment.Arguments = _dataBundle;
                    _viewTitle = "My Inventory";
                    break;

                case 3:     //MY Requests
                    interfaceFragment           = UserRequestsFragment.NewInstance();
                    interfaceFragment.Arguments = _dataBundle;
                    _viewTitle          = "Requests";
                    _requestItemVisible = true;
                    break;

                case 4:     //Settings
                    interfaceFragment           = UserSettingsFragment.NewInstance();
                    interfaceFragment.Arguments = _dataBundle;
                    _viewTitle = "Settings";
                    break;

                case 5:     //HELP
                    interfaceFragment = HelpFragment.NewInstance();
                    _viewTitle        = "Help";
                    break;

                case 6:     //Sign out
                    //confirm user action
                    SignOutUser();
                    break;
                }

                Toolbar.Title = _viewTitle;
                if (_editProfileMenuItem != null)
                {
                    _editProfileMenuItem.SetVisible(_editItemVisible);
                }

                if (_addRequestItem != null)
                {
                    _addRequestItem.SetVisible(_requestItemVisible);
                }
                SupportFragmentManager.BeginTransaction()
                .Replace(Resource.Id.content_frame, interfaceFragment)
                .Commit();
            }
            catch (Exception ex)
            {
                var message = string.Format("Error loading home details {0} {1}", ex.Message, ex.StackTrace);
                Console.WriteLine(message);
                MetricsManager.TrackEvent(message);
                Toast.MakeText(this, "Vehicle not details lodaded successfully, please try again " + ex.Message,
                               ToastLength.Short);
                ListItemClicked(0); //reset to homepage
            }
        }