本文整理汇总了C#中IMenuItem.GetItemId方法的典型用法代码示例。如果您正苦于以下问题:C# IMenuItem.GetItemId方法的具体用法?C# IMenuItem.GetItemId怎么用?C# IMenuItem.GetItemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMenuItem
的用法示例。
在下文中一共展示了IMenuItem.GetItemId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnActionItemClicked
/** This is called when an item in the context menu is selected */
public bool OnActionItemClicked(ActionMode mode, IMenuItem item)
{
switch (item.GetItemId())
{
case R.Ids.submenu:
Toast.MakeText(mainActivity.GetBaseContext(), "Selected Action1 ", Toast.LENGTH_LONG).Show();
mode.Finish(); // Automatically exists the action mode, when the user selects this action
break;
}
return false;
}
示例2: OnContextItemSelected
public override bool OnContextItemSelected(IMenuItem item) {
switch (item.GetItemId()) {
case R.Ids.a_item:
Log.I("ContextMenu", "Item 1a was chosen");
return true;
case R.Ids.b_item:
Log.I("ContextMenu", "Item 1b was chosen");
return true;
}
return base.OnContextItemSelected(item);
}
示例3: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.GetItemId())
{
case Android.R.Id.Home:
Intent homeIntent = new Intent(this, typeof(MainActivity));
StartActivity(homeIntent);
return true;
default:
return base.OnOptionsItemSelected(item);
}
}
示例4: OnOptionsItemSelected
override public bool OnOptionsItemSelected(IMenuItem item)
{
int itemId = item.GetItemId();
if (itemId == R.Ids.change_locale)
{
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.SetAction(Android.Provider.Settings.ACTION_LOCALE_SETTINGS);
intent.AddCategory(Intent.CATEGORY_DEFAULT);
StartActivity(intent);
return true;
}
return base.OnOptionsItemSelected(item);
}
示例5: OnOptionsItemSelected
/// <summary>
/// Menu option has been clicked.
/// </summary>
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.GetItemId())
{
case R.Ids.Refresh:
GetFixturesAsync(true);
break;
case R.Ids.Settings:
ShowSettings();
break;
}
return base.OnOptionsItemSelected(item);
}
示例6: OnOptionsItemSelected
/// <summary>
/// Menu option has been clicked.
/// </summary>
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.GetItemId())
{
case R.Ids.item1:
tbLog.Text = "item1 has been clicked";
break;
case R.Ids.groupItem1:
tbLog.Text = "groupItem1 has been clicked";
break;
case R.Ids.submenu_item1:
tbLog.Text = "submenu_item1 has been clicked";
break;
}
return base.OnOptionsItemSelected(item);
}
示例7: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.GetItemId())
{
case R.Ids.settingMenuItem:
var settingsIntent = new Intent(this, typeof(MyPreferencesActivity));
StartActivity(settingsIntent);
return true;
default:
return base.OnOptionsItemSelected(item);
}
}
示例8: OnOptionsItemSelected
/// <summary>
/// Invoked when the user selects an item from the Menu.
/// </summary>
/// <param name="item"> the Menu entry which was selected </param>
/// <returns> true if the Menu item was legit (and we consumed it), false
/// otherwise </returns>
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.GetItemId())
{
case MENU_START:
mLunarThread.DoStart();
return true;
case MENU_STOP:
mLunarThread.SetState(LunarView.LunarThread.STATE_LOSE, GetText(R.Strings.message_stopped));
return true;
case MENU_PAUSE:
mLunarThread.Pause();
return true;
case MENU_RESUME:
mLunarThread.Unpause();
return true;
case MENU_EASY:
mLunarThread.Difficulty = LunarView.LunarThread.DIFFICULTY_EASY;
return true;
case MENU_MEDIUM:
mLunarThread.Difficulty = LunarView.LunarThread.DIFFICULTY_MEDIUM;
return true;
case MENU_HARD:
mLunarThread.Difficulty = LunarView.LunarThread.DIFFICULTY_HARD;
return true;
}
return false;
}
示例9: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
Intent serverIntent = null;
switch (item.GetItemId())
{
case R.Ids.secure_connect_scan:
// Launch the DeviceListActivity to see devices and do scan
serverIntent = new Intent(this, typeof(DeviceListActivity));
StartActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_SECURE);
return true;
case R.Ids.insecure_connect_scan:
// Launch the DeviceListActivity to see devices and do scan
serverIntent = new Intent(this, typeof(DeviceListActivity));
StartActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_INSECURE);
return true;
case R.Ids.discoverable:
// Ensure this device is discoverable by others
EnsureDiscoverable();
return true;
}
return false;
}