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


C# IMenu类代码示例

本文整理汇总了C#中IMenu的典型用法代码示例。如果您正苦于以下问题:C# IMenu类的具体用法?C# IMenu怎么用?C# IMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IMenu类属于命名空间,在下文中一共展示了IMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Save

        public string Save(IMenu menu)
        {
            if (_menuRepository == null)
                throw new ArgumentNullException("MenuRepository cannot be null");
            if (menu.Id == 0)
            {
                // new menu
                menu.DateCreated = DateTime.Now;
                menu.Active = true;
                menu.DateModified = null;
                _menuRepository.Add((DF.Domain.Concrete.Menu)menu);

                _menuRepository.UnitOfWork.Commit();

            }
            else
            {
                var oMenu = _menuRepository.Where(u => u.Id == menu.Id).SingleOrDefault();

                if (oMenu == null)
                    throw new ArgumentNullException("menu");

                menu.DateCreated = oMenu.DateCreated;

                Magically.CopyPropertyValues(ref oMenu, (Menu)menu);

                _menuRepository.UnitOfWork.Commit();

            }

            return string.Format("Successfully saved menu {0}", menu.DisplayText);
        }
开发者ID:sunilbulusu,项目名称:DealerSoftware,代码行数:32,代码来源:MenuManager.cs

示例2: OnCreateOptionsMenu

        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            // Inflate the menu
            MenuInflater.Inflate (Resource.Menu.ActionBarActionProvider, menu);

            // Set file with share history to the provider and set the share intent.
            var action_item = menu.FindItem (Resource.Id.menu_item_share_action_provider_action_bar);
            var action_provider = (ShareActionProvider)action_item.ActionProvider;

            action_provider.SetShareHistoryFileName (ShareActionProvider.DefaultShareHistoryFileName);

            // Note that you can set/change the intent any time,
            // say when the user has selected an image.
            action_provider.SetShareIntent (CreateShareIntent ());

            // Set file with share history to the provider and set the share intent.
            var overflow_item = menu.FindItem (Resource.Id.menu_item_share_action_provider_overflow);
            var overflow_provider = (ShareActionProvider)overflow_item.ActionProvider;

            overflow_provider.SetShareHistoryFileName (ShareActionProvider.DefaultShareHistoryFileName);

            // Note that you can set/change the intent any time,
            // say when the user has selected an image.
            overflow_provider.SetShareIntent (CreateShareIntent ());

            return true;
        }
开发者ID:ogborstad,项目名称:monodroid-samples,代码行数:27,代码来源:ActionBarActionProviderActivity.cs

示例3: OnCreateOptionsMenu

        /// <summary>
        /// http://mgroves.com/monodroid-creating-an-options-menu/ 
        /// </summary>
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            var item = menu.Add(Menu.None, 1, 1, new Java.Lang.String("Schedule"));
            //item.SetIcon(Resource.Drawable.calendar);

            item = menu.Add(Menu.None, 2, 2, new Java.Lang.String("Speakers"));  // HACK: todo - add 'using' statement around Java.Lang.Strings for GC (as per novell hint)
            //item.SetIcon(Resource.Drawable.microphone);

            item = menu.Add(Menu.None, 3, 3, new Java.Lang.String("Sessions"));
            //item.SetIcon(Resource.Drawable.bullhorn);

            item = menu.Add(Menu.None, 4, 4, new Java.Lang.String("Map"));
            //item.SetIcon(Resource.Drawable.map);

            item = menu.Add(Menu.None, 5, 5, new Java.Lang.String("Favorites"));
            //item.SetIcon(Resource.Drawable.star);

            item = menu.Add(Menu.None, 6, 6, new Java.Lang.String("News"));
            //item.SetIcon(Resource.Drawable.star);

            item = menu.Add(Menu.None, 7, 7, new Java.Lang.String("Twitter"));
            //item.SetIcon(Resource.Drawable.star);

            item = menu.Add(Menu.None, 8, 8, new Java.Lang.String("Exhibitors"));
            //item.SetIcon(Resource.Drawable.star);

            item = menu.Add(Menu.None, 9, 9, new Java.Lang.String("About Xamarin"));
            //item.SetIcon(Resource.Drawable.star);

            return true;
        }
开发者ID:kssagra,项目名称:SagraEmi,代码行数:34,代码来源:BaseScreen.cs

示例4: getMenuFullPath

        /// <summary>
        /// 不包括http、域名、application path和网址后缀(仅仅是path)
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="menu"></param>
        /// <returns></returns>
        public static String getMenuFullPath( MvcContext ctx, IMenu menu )
        {
            String url = menu.RawUrl;
            String ownerPathAndUrl = getMemberPathUrlByMenu( menu );

            // 带http的完整网址
            Boolean isFullUrl = PathHelper.IsFullUrl( url );
            if (isFullUrl) return url;

            // 包括完整的ownerPath
            if (url.StartsWith( "/" )) {
                return url + MvcConfig.Instance.UrlExt;
            }

            String result = url;
            if (url.StartsWith( ctx.url.AppPath )) {
                result = strUtil.TrimStart( url, ctx.url.AppPath );
            }

            if (result.StartsWith( ownerPathAndUrl )) {
                result = strUtil.TrimStart( result, ownerPathAndUrl );
            }
            if (result.StartsWith( "/" + ownerPathAndUrl ) && strUtil.HasText( ownerPathAndUrl )) {
                result = strUtil.TrimStart( result, "/" + ownerPathAndUrl );
            }

            String location = strUtil.Join( ctx.url.AppPath, ownerPathAndUrl );
            result = strUtil.Join( location, result );
            return result;
        }
开发者ID:robin88,项目名称:wojilu,代码行数:36,代码来源:UrlConverter.cs

示例5: OnCreateOptionsMenu

        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            this.MenuInflater.Inflate (Resource.Menu.ActionBarMenu, menu);
            var addFeedButton = menu.FindItem (Resource.Id.AddFeedItem);

            return base.OnCreateOptionsMenu (menu);
        }
开发者ID:james-dibble,项目名称:NugetExplorer,代码行数:7,代码来源:MainActivity.cs

示例6: Inflate

 public virtual void Inflate(int menuRes, IMenu menu, object parent)
 {
     using (XmlReader reader = _context.Resources.GetLayout(menuRes))
     {
         //NOTE XDocument throws an error.
         var document = new XmlDocument();
         document.Load(reader);
         if (IsDefaultMenu(document))
         {
             MenuInflater menuInflater = NestedMenuInflater;
             if (menuInflater == null)
                 base.Inflate(menuRes, menu);
             else
                 menuInflater.Inflate(menuRes, menu);
         }
         else
         {
             using (var stringReader = new StringReader(PlatformExtensions.XmlTagsToUpper(document.InnerXml)))
             {
                 var menuWrapper = (MenuTemplate)Serializer.Deserialize(stringReader);
                 menuWrapper.Apply(menu, _context, parent);
             }
         }
     }
 }
开发者ID:dbeattie71,项目名称:MugenMvvmToolkit,代码行数:25,代码来源:BindableMenuInflater.cs

示例7: OnCreateOptionsMenu

		public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
		{
			var conferencesScheduleViewModel = this.DataContext as ConferencesScheduleViewModel;

			inflater.Inflate(Resource.Menu.ConferencesListActionItems, menu);

			var searchView = (SearchView)menu.FindItem(Resource.Id.menu_search).ActionView;

			var textChangedLastTime = DateTime.Now;
			searchView.QueryTextChange += async (object sender, SearchView.QueryTextChangeEventArgs e) => 
			{
				var changedSpan = DateTime.Now.Subtract(textChangedLastTime);
				if (changedSpan.TotalMilliseconds > 200)
				{
					await conferencesScheduleViewModel.SearchAsync(e.NewText);
				}
				textChangedLastTime = DateTime.Now;
			};

			searchView.Close += async (sender, e) => 
			{
				await conferencesScheduleViewModel.LoadConferencesAsync(LoadRequest.Load);
				searchView.ClearFocus();
				searchView.OnActionViewCollapsed();
			};

			searchView.QueryTextSubmit += async (sender, e) => {
				await conferencesScheduleViewModel.SearchAsync(e.Query);
				searchView.ClearFocus();
				searchView.OnActionViewCollapsed(); 
			};
		}
开发者ID:prca,项目名称:tekconf.mobile,代码行数:32,代码来源:ConferencesScheduleFragment.cs

示例8: OnPrepareOptionsMenu

 /// <summary>
 /// Overrides this to enable SVG in toolbar icons.
 /// </summary>
 public override bool OnPrepareOptionsMenu(IMenu menu)
 {
     //don't call base version.
     //var ok=base.OnPrepareOptionsMenu(menu);
     //SvgImageRenderer.PrepareMenu(this, menu);
     return true;
 }
开发者ID:softlion,项目名称:XamSvg-Samples,代码行数:10,代码来源:MainActivity.cs

示例9: OnPrepareOptionsMenu

        public override bool OnPrepareOptionsMenu(IMenu menu)
        {
            menu.GetItem (4).SetVisible (true);	// add
            switch (ViewModel.State) {
            case 0:	// idle
                menu.GetItem (0).SetVisible (false);	// go
                menu.GetItem (1).SetVisible (false);	// pause
                menu.GetItem (2).SetVisible (false);	// resume
                menu.GetItem (3).SetVisible (false);	// finish
                break;

            case 1:	// go
                menu.GetItem (0).SetVisible (false);	// go
                menu.GetItem (1).SetVisible (true);		// pause
                menu.GetItem (2).SetVisible (false);	// resume
                menu.GetItem (3).SetVisible (true);		// finish
                break;

            case 2:	// pause
                menu.GetItem (0).SetVisible (false);	// go
                menu.GetItem (1).SetVisible (false);	// pause
                menu.GetItem (2).SetVisible (true);		// resume
                menu.GetItem (3).SetVisible (true);		// finish
                break;

            default:
                throw new NotImplementedException ();
            }

            return true;
        }
开发者ID:ruly-rudel,项目名称:ruly,代码行数:31,代码来源:MainActivity.cs

示例10: OnPrepareOptionsMenu

        public override bool OnPrepareOptionsMenu(IMenu menu)
        {
            var refresh = menu.FindItem(Resource.Id.mvxplugins_action_relogin);
            refresh.SetVisible(_showRefresh);

            return base.OnPrepareOptionsMenu(menu);
        }
开发者ID:kstreet,项目名称:Cheesebaron.MvxPlugins,代码行数:7,代码来源:DefaultLoginIdentityProviderListView.cs

示例11: OnCreateOptionsMenu

        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            Activity.MenuInflater.Inflate (Resource.Menu.schedule_menu, menu);

            //Handle share action provider
            var shareMenuItem = menu.FindItem (Resource.Id.action_schedule_share);
            var shareActionProvider =
                (ShareActionProvider)shareMenuItem.ActionProvider;
            shareActionProvider.SetShareIntent (CreateIntent ());

            //Handle search action provider
            var searchOption = menu.FindItem(Resource.Id.action_schedule_search);

            //Handle expand/colapse of action bar
            MenuItemCompat.SetOnActionExpandListener(searchOption, new SearchViewExpandListener(_adapter));

            var searchItem = MenuItemCompat.GetActionView(searchOption);
            _searchView = searchItem.JavaCast<SearchView>();
            _searchView.QueryTextChange += (s, e) => _adapter.Filter.InvokeFilter(e.NewText);

            _searchView.QueryTextSubmit += (s, e) =>
            {
                Toast.MakeText(Activity, "Searched for: " + e.Query, ToastLength.Short).Show();
                e.Handled = true;
            };
        }
开发者ID:jheerman,项目名称:LGSAMobile,代码行数:26,代码来源:ScheduleFragment.cs

示例12: OnCreateOptionsMenu

        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            if (MenuId > 0)
                MenuInflater.Inflate(MenuId, menu);

            return base.OnCreateOptionsMenu(menu);
        }
开发者ID:pacificIT,项目名称:LegacyBar,代码行数:7,代码来源:LegacyBarExpandableListActivity.cs

示例13: deleteDefaulHtml

 private void deleteDefaulHtml( IMenu menu )
 {
     String defaultHtml = getDefaultPagePath();
     if (file.Exists( defaultHtml )) {
         file.Delete( defaultHtml );
     }
 }
开发者ID:Boshin,项目名称:wojilu,代码行数:7,代码来源:MenuController.cs

示例14: OnPrepareOptionsMenu

        public override bool OnPrepareOptionsMenu(IMenu menu)
        {
            menuLockItem = menu.FindItem(Resource.Id.menu_lock);
            ToggleLockBtnTitle();

            return base.OnPrepareOptionsMenu(menu);
        }
开发者ID:cyecp,项目名称:XamarinComponents,代码行数:7,代码来源:ViewPagerSampleActivity.cs

示例15: OnPrepareOptionsMenu

        public override void OnPrepareOptionsMenu(IMenu menu)
        {
            IMenuItem fav_item = menu.FindItem(Resource.Id.favorite_action_button);
            fav_item.SetVisible(true);

            base.OnPrepareOptionsMenu(menu);
        }
开发者ID:erdennis13,项目名称:EthansList,代码行数:7,代码来源:CategoryPickerFragment.cs


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