private void btn_myaggiewelcome_Click(object sender, EventArgs e, Activity currentActivity) { try { btn_myaggiewelcome.Click -= (sndr, argus) => btn_myaggiewelcome_Click(sndr, argus, currentActivity); AppInfoFragment appInfoFragment = new AppInfoFragment(); Android.Support.V4.App.FragmentTransaction tx = FragmentManager.BeginTransaction(); //tx.Add(Resource.Id.m_main, appInfoFragment); tx.Replace(Resource.Id.m_main, appInfoFragment, Constants.appinfo); mCurrentFragment = appInfoFragment; tx.Commit(); } catch (Exception ex) { currentActivity.RunOnUiThread(() => { Android.App.AlertDialog.Builder alertDiag = new Android.App.AlertDialog.Builder(currentActivity); alertDiag.SetTitle(Resource.String.DialogHeaderError); alertDiag.SetMessage(ex.Message); alertDiag.SetIcon(Resource.Drawable.alert); alertDiag.SetPositiveButton(Resource.String.DialogButtonOk, (senderAlert, args) => { btn_myaggiewelcome.Click += (sndr, argus) => btn_myaggiewelcome_Click(sndr, argus, currentActivity); }); Dialog diag = alertDiag.Create(); diag.Show(); diag.SetCanceledOnTouchOutside(false); }); } }
private void ItemSearch_clicked(object sender, AdapterView.ItemClickEventArgs e, Activity currentActivity) { try { androidGridView.ItemClick -= (sndr, argus) => ItemSearch_clicked(sndr, argus, currentActivity); switch (gridViewCodeString[e.Position]) { case "WLC": { AppInfoFragment appInfoFragment = new AppInfoFragment(); Android.Support.V4.App.FragmentTransaction tx = FragmentManager.BeginTransaction(); tx.Replace(Resource.Id.m_main, appInfoFragment, Constants.appinfo); mCurrentFragment = appInfoFragment; tx.Commit(); break; } case "MYFRM": { MyFarmDashboardFragment obj = new MyFarmDashboardFragment(); Android.Support.V4.App.FragmentTransaction tx = FragmentManager.BeginTransaction(); tx.Replace(Resource.Id.m_main, obj, Constants.myfarmdash); mCurrentFragment = obj; tx.Commit(); break; } case "VWACT": { ActivityViewerFragment activityViewerFragment = new ActivityViewerFragment(); Android.Support.V4.App.FragmentTransaction tx = FragmentManager.BeginTransaction(); tx.Replace(Resource.Id.m_main, activityViewerFragment, Constants.activityviewer); mCurrentFragment = activityViewerFragment; tx.Commit(); break; } } } catch (Exception ex) { currentActivity.RunOnUiThread(() => { Android.App.AlertDialog.Builder alertDiag = new Android.App.AlertDialog.Builder(currentActivity); alertDiag.SetTitle(Resource.String.DialogHeaderError); alertDiag.SetMessage(ex.Message); alertDiag.SetIcon(Resource.Drawable.alert); alertDiag.SetPositiveButton(Resource.String.DialogButtonOk, (senderAlert, args) => { androidGridView.ItemClick += (sndr, argus) => ItemSearch_clicked(sndr, argus, currentActivity); }); Dialog diag = alertDiag.Create(); diag.Show(); diag.SetCanceledOnTouchOutside(false); }); } }
public static Android.Support.V4.App.Fragment newInstance(Context context) { AppInfoFragment busrouteFragment = new AppInfoFragment(); return(busrouteFragment); }