当前位置: 首页>>代码示例>>C#>>正文


C# IMenuItem.GetItemId方法代码示例

本文整理汇总了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;
 }
开发者ID:rfcclub,项目名称:dot42,代码行数:12,代码来源:ActionMode.cs

示例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);
 }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:11,代码来源:FragmentContextMenuSupport.cs

示例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);
     }
 }
开发者ID:sschocke,项目名称:JGCompanion,代码行数:12,代码来源:StationInventoryActivity.cs

示例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);
 }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:13,代码来源:PlusSampleActivity.cs

示例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);
 }
开发者ID:paulclarkin,项目名称:WillFootballRuinMyDayCSharp,代码行数:16,代码来源:MainActivity.cs

示例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);
        }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:20,代码来源:MainActivity.cs

示例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);
     }
 }
开发者ID:sschocke,项目名称:JGCompanion,代码行数:12,代码来源:MainActivity.cs

示例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;
        }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:35,代码来源:LunarLander.cs

示例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;
 }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:22,代码来源:BluetoothChat.cs


注:本文中的IMenuItem.GetItemId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。