Example #1
0
		public DiemThiFragment () 
		{
			instance = this;
		}
        private void SelectItem(int position)
        {
            var fragment=new Fragment();
            switch (position) {
            case 0:
                fragment = new LichHocFragment ();
                break;
            case 1:
                fragment = new LichThiFragment ();
                break;
            case 2:
                fragment = new DiemThiFragment ();
                break;
            case 3:
                fragment = new HocPhiFragment ();
                break;
            default:
                fragment = new LichThiFragment ();
                break;
            }

            FragmentManager.BeginTransaction()
                .Replace(Resource.Id.content_frame, fragment)
                .Commit();

            _drawerList.SetItemChecked(position, true);
            ActionBar.Title = _title = _menuTitles[position];
            _drawer.CloseDrawer(_drawerList);
        }
Example #3
0
		public void SelectItem(int position)
		{
			bundle=Common.LoadSettings ();
			var fragment=new Fragment();
            switch (position) {
			case 0:
				break;
            case 1:
                break;
            case 2:
                fragment = new LichHocHKFragment ();
                break;
            case 3:
                fragment = new LichHocTuanFragment ();
                break;
            case 4:
                break;
			case 5:
				fragment = new DiemThiHKFragment ();
				break;
			case 6:
				fragment = new DiemThiFragment ();
				break;
			case 7:
				
				break;
			case 8:
				fragment = new LichThiFragment ();
				break;
			case 9:
				fragment = new HocPhiFragment ();
				break;
			case 10:
				
				break;
			case 11:
				fragment = new SettingsFragment ();
				break;
			
			case 12:
				AlertDialog.Builder builder = new AlertDialog.Builder (
					                      this);

				// Setting Dialog Title

				builder.SetTitle (Resource.String.Alertitle); 
				builder.SetIcon (Android.Resource.Drawable.IcDialogAlert); 
				builder.SetMessage ("Bạn có muốn đăng xuất khỏi ứng dụng?"); 
				builder.SetPositiveButton ("Có", (sender, e) => {
					BUser.LogOut (SQLite_Android.GetConnection ());
					var prefs = Application.Context.GetSharedPreferences ("SGU APP", FileCreationMode.Private);
					prefs.Edit ().Clear ().Commit ();
					Intent myintent = new Intent (this, typeof(LoginActivity));
					StartActivity (myintent);
					this.Finish ();
				});
				builder.SetNegativeButton ("Không", (sender, e) => {
				});
				builder.Show(); 


				// Setting Dialog Message
			

				break;
           
            }

			if (position != 0&&position!=1&&position!=4&&position!=7&&position!=10&&position!=12) {
				
					fragment.Arguments = bundle;
					FragmentManager.BeginTransaction ()
					.Replace (Resource.Id.content_frame, fragment).AddToBackStack ("" + previousItemChecked)
				.Commit ();
				if (position == previousItemChecked && FragmentManager.BackStackEntryCount > 1) {
					FragmentManager.PopBackStackImmediate ();

				}
					_drawerList.SetItemChecked (position, true);
					previousItemChecked = _drawerList.CheckedItemPosition;

			
					ActionBar.Title = _title = _menuTitles [position];
					_drawer.CloseDrawer (_drawerList);
				}

		}