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


C# IMenuItem类代码示例

本文整理汇总了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;
		}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:7,代码来源:BasicImmersiveModeFragment.cs

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

示例3: OnOptionsItemSelected

		public override bool OnOptionsItemSelected (IMenuItem item)
		{
			if (item.ItemId == Android.Resource.Id.Home)
				Finish ();

			return base.OnOptionsItemSelected (item);
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:7,代码来源:DetailActivity.cs

示例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);
        }
开发者ID:Magenic,项目名称:WhitepaperPerformance,代码行数:34,代码来源:AddIncidentView.cs

示例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);
            }

        }
开发者ID:Poli143,项目名称:Login,代码行数:34,代码来源:przegladKategori.cs

示例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);
        }
开发者ID:cyecp,项目名称:XamarinComponents,代码行数:29,代码来源:RotationSampleActivity.cs

示例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;
        }
开发者ID:jorik041,项目名称:Sample-Projects,代码行数:26,代码来源:BrowserActivity.cs

示例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);
        }
开发者ID:skywolf888,项目名称:ViewPagerIndicator.Net,代码行数:28,代码来源:BaseSampleActivity.cs

示例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;
        }
开发者ID:ybs2011,项目名称:ADFC-NewsApp-Mono,代码行数:32,代码来源:News.cs

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

示例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);
        }
开发者ID:Dexyon,项目名称:ViewPagerIndicator,代码行数:29,代码来源:BaseSampleActivity.cs

示例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);
        }
开发者ID:chadsmith12,项目名称:Spring-Time,代码行数:28,代码来源:MainFragment.cs

示例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);
        }
开发者ID:MilenPavlov,项目名称:Xam.NavDrawer,代码行数:30,代码来源:FriendView.cs

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

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


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