本文整理汇总了C#中IMenuItem类的典型用法代码示例。如果您正苦于以下问题:C# IMenuItem类的具体用法?C# IMenuItem怎么用?C# IMenuItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMenuItem类属于命名空间,在下文中一共展示了IMenuItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnOptionsItemSelected
public override bool OnOptionsItemSelected (IMenuItem item)
{
if (item.ItemId == Resource.Id.sample_action) {
ToggleHideyBar ();
}
return true;
}
示例2: OnOptionsItemSelected
/// <param name="item">The menu item that was selected.</param>
/// <summary>
/// This hook is called whenever an item in your options menu is selected.
/// </summary>
/// <returns>To be added.</returns>
public override bool OnOptionsItemSelected(IMenuItem item)
{
base.OnOptionsItemSelected(item);
switch (item.ItemId)
{
case Resource.Id.btnYoum7:
{
Finish();
StartActivity(new Intent(this, typeof(FeedYoum7)));
break;
}
case Resource.Id.btnFilGoal:
{
Finish();
StartActivity(new Intent(this, typeof(FeedFilGoal)));
break;
}
case Resource.Id.btnWPcentral:
{
Finish();
StartActivity(new Intent(this, typeof(FeedWPcentral)));
break;
}
}
return true;
}
示例3: OnOptionsItemSelected
public override bool OnOptionsItemSelected (IMenuItem item)
{
if (item.ItemId == Android.Resource.Id.Home)
Finish ();
return base.OnOptionsItemSelected (item);
}
示例4: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
if (item.ItemId == Resource.Id.mnuAddIncidentTakePhoto)
{
ViewModel.TakeNewPhotoCommand.Execute(null);
return true;
}
else if (item.ItemId == Resource.Id.mnuAddIncidentAttachImage)
{
ViewModel.SelectPhotoCommand.Execute(null);
return true;
}
else if (item.ItemId == Resource.Id.mnuAddIncidentRecordAudio)
{
ViewModel.RecordAudioCommand.Execute(null);
return true;
}
else if (item.ItemId == Android.Resource.Id.Home)
{
Finish();
return true;
}
else if (item.ItemId == Resource.Id.mnuAddIncidentContinue)
{
ViewModel.SaveNewIncidentCommand.Execute(null);
return true;
}
else
{
throw new NotImplementedException();
}
return base.OnOptionsItemSelected(item);
}
示例5: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
if (mDrawerToggle.OnOptionsItemSelected(item))
{
if (mDrawerLayout.IsDrawerOpen(mRightDrawer))
{
mDrawerLayout.CloseDrawer(mRightDrawer);
}
return true;
}
switch (item.ItemId)
{
case Resource.Id.menu:
if (mDrawerLayout.IsDrawerOpen(mRightDrawer))
{
mDrawerLayout.CloseDrawer(mRightDrawer);
}
else
{
mDrawerLayout.CloseDrawer(mLeftDrawer);
mDrawerLayout.OpenDrawer(mRightDrawer);
}
return true;
default:
return base.OnOptionsItemSelected(item);
}
}
示例6: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case 0:
photo.SetRotationBy(10);
return true;
case 1:
photo.SetRotationBy(-10);
return true;
case 2:
ToggleRotation();
return true;
case 3:
photo.SetRotationTo(0);
return true;
case 4:
photo.SetRotationTo(90);
return true;
case 5:
photo.SetRotationTo(180);
return true;
case 6:
photo.SetRotationTo(270);
return true;
}
return base.OnOptionsItemSelected(item);
}
示例7: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.refresh:
_browser.Reload();
break;
case Resource.Id.stop:
_browser.StopLoading();
break;
case Resource.Id.settings:
StartActivity(typeof(SettingsActivity));
break;
case Resource.Id.home:
goToHomePageIfSet();
break;
case Resource.Id.history:
var intent = new Intent(this, typeof(HistoryActivity));
StartActivityForResult(intent, HISTORY_REQUEST_CODE);
break;
default:
return base.OnOptionsItemSelected(item);
}
return true;
}
示例8: OnOptionsItemSelected
//@Override
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId) {
case R.Id.random:
int page = 0;
page = RANDOM.Next(mAdapter.Count);
Toast.MakeText(this, "Changing to page " + Convert.ToString(page), ToastLength.Short);
mPager.SetCurrentItem(page,true);
return true;
case R.Id.add_page:
if (mAdapter.Count < 10) {
mAdapter.setCount(mAdapter.getCount() + 1);
mIndicator.notifyDataSetChanged();
}
return true;
case R.Id.remove_page:
if (mAdapter.getCount() > 1) {
mAdapter.setCount(mAdapter.getCount() - 1);
mIndicator.notifyDataSetChanged();
}
return true;
}
return base.OnOptionsItemSelected(item);
}
示例9: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch(item.ItemId)
{
case Resource.Id.menuSettings:
Intent setIntent = new Intent(this, typeof(Settings));
StartActivityForResult(setIntent, 0);
break;
case Resource.Id.menuGetDataNow:
new FeedHelper().UpdateBGFeeds(this);
break;
case Resource.Id.menuShowReadNews:
showOnlyUnreadNews = !showOnlyUnreadNews;
LoadNews();
if (!showOnlyUnreadNews)
item.SetTitle("Ungelesene News");
else
item.SetTitle("Alle News");
break;
case Resource.Id.menuMarkAllRead:
new de.dhoffmann.mono.adfcnewsapp.buslog.database.Rss().MarkItemsAsRead(null, true);
LoadNews();
break;
}
return true;
}
示例10: OnMenuItemSelected
public override bool OnMenuItemSelected(int featureID, IMenuItem item)
{
base.OnMenuItemSelected(featureID, item);
// Een menuItem selecteren en naar de toegewenste activity gaan
switch (item.ItemId)
{
case (1):
{
// Intent maken en doorgaan naar Home
var MenuIntent = new Intent(this, typeof(MainActivity));
StartActivity(MenuIntent);
return (true);
}
case (2):
{
// Intent maken en doorgaan naar Formulier
var MenuIntent = new Intent(this, typeof(Formulier));
StartActivity(MenuIntent);
return (true);
}
case (3):
{
// Intent maken en doorgaan naar Formulier
var MenuIntent = new Intent(this, typeof(Overzicht));
StartActivity(MenuIntent);
return (true);
}
}
return (false);
}
示例11: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.random:
var page = _random.Next(_adapter.Count);
Toast.MakeText(this, "Changing to page " + page, ToastLength.Short).Show();
_pager.CurrentItem = page;
return true;
case Resource.Id.add_page:
if (_adapter.Count < 10)
{
_adapter.SetCount(_adapter.Count + 1);
_indicator.NotifyDataSetChanged();
}
return true;
case Resource.Id.remove_page:
if (_adapter.Count > 1)
{
_adapter.SetCount(_adapter.Count - 1);
_indicator.NotifyDataSetChanged();
}
return true;
}
return base.OnOptionsItemSelected(item);
}
示例12: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
var id = item.ItemId;
// refresh
if (id == Resource.Id.refresh_weather)
{
SetForecastInfo();
return true;
}
// settings
if (id == Resource.Id.action_settings)
{
StartActivity(new Intent(Activity, typeof(SettingsActivity)));
return true;
}
// view location on the map
if (id == Resource.Id.action_location)
{
Intents.StartMap(Activity);
return true;
}
return base.OnOptionsItemSelected(item);
}
示例13: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Android.Resource.Id.Home:
//Wrong:
//var intent = new Intent(this, typeof(HomeView));
//intent.AddFlags(ActivityFlags.ClearTop);
//StartActivity(intent);
NavUtils.NavigateUpFromSameTask(this);
//if this could be launched externally:
/*
var upIntent = NavUtils.GetParentActivityIntent(this);
if (NavUtils.ShouldUpRecreateTask(this, upIntent))
{
Android.Support.V4.App.TaskStackBuilder.Create(this).
AddNextIntentWithParentStack(upIntent).
StartActivities();
}
else
{
NavUtils.NavigateUpTo(this, upIntent);
}
*/
break;
}
return base.OnOptionsItemSelected(item);
}
示例14: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId) {
case Resource.Id.sendSMS:
break;
case Resource.Id.menuCreateGroup:
var groupName = new EditText(this);
new AlertDialog.Builder(this)
.SetTitle ("New SMS Group")
.SetMessage ("Please enter a name for the SMS group:")
.SetView (groupName)
.SetPositiveButton ("Ok", (o, e) => {
var imm = (InputMethodManager)GetSystemService(InputMethodService);
imm.HideSoftInputFromWindow (groupName.WindowToken, HideSoftInputFlags.None);
var intent = new Intent();
intent.SetClass(this, typeof(NewSmsGroupActivity));
intent.PutExtra("name", groupName.Text);
StartActivity(intent);
})
.SetNegativeButton ("Cancel", (o, e) => { })
.Show ();
break;
}
return true;
}
示例15: OnOptionsItemSelected
// Pass the event to ActionBarDrawerToggle, if it returns
// true, then it has handled the app icon touch event
public override bool OnOptionsItemSelected(IMenuItem item)
{
if (drawerToggle.OnOptionsItemSelected(item))
return true;
return base.OnOptionsItemSelected(item);
}