示例#1
0
        //define action for navigation menu selection
        void NavigationView_NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e)
        {
            PackageManager manager = this.PackageManager;
            PackageInfo    info    = manager.GetPackageInfo(this.PackageName, 0);
            string         version = ApplicationInfo.LoadLabel(PackageManager) + "\n" + info.VersionName;

            switch (e.MenuItem.ItemId)
            {
            case (Resource.Id.nav_about):
                Toast.MakeText(this, version, ToastLength.Long).Show();
                break;

            case (Resource.Id.nav_logout):
                LoginService.Logout();
                StartActivity(typeof(LoginActivity));
                Finish();
                break;

            case (Resource.Id.nav_exit):
                Finish();
                break;
            }
            // Close drawer
            drawerLayout.CloseDrawers();
        }