本文整理汇总了C#中IMenuItem.SetEnabled方法的典型用法代码示例。如果您正苦于以下问题:C# IMenuItem.SetEnabled方法的具体用法?C# IMenuItem.SetEnabled怎么用?C# IMenuItem.SetEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMenuItem
的用法示例。
在下文中一共展示了IMenuItem.SetEnabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnOptionsItemSelected
//Select an option from the menu
public override bool OnOptionsItemSelected (IMenuItem item)
{
if (item.ItemId == Resource.Id.menu_refresh) {
item.SetEnabled(false);
OnRefreshItemsSelected ();
item.SetEnabled(true);
}
return true;
}
示例2: OnCreateOptionsMenu
public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
{
// inflater.Inflate (Resource.Menu.mfActionBar, menu);
miAddAtt = menu.Add (1, 1, 1, @"Начать посещение");
miAddAtt.SetIcon (Resource.Drawable.ic_add_circle_outline_white_48dp);
// miAddAtt.SetShowAsAction()
miAddAtt.SetEnabled (true);
// miAddAtt.Id
miAddPhoto = menu.Add(1, 2, 2, @"Добавить фото");
miAddPhoto.SetIcon (Resource.Drawable.ic_camera_alt_white_48dp);
miAddPhoto.SetEnabled (false);
base.OnCreateOptionsMenu (menu, inflater);
}
示例3: OnCreateOptionsMenu
public override bool OnCreateOptionsMenu(IMenu menu)
{
MenuInflater.Inflate (Resource.Menu.DetailMenu, menu);
menuSave = menu.FindItem (Resource.Id.menu_detail_save);
menuDelete = menu.FindItem (Resource.Id.menu_detail_delete);
menuResume = menu.FindItem (Resource.Id.menu_detail_resume);
menuStart = menu.FindItem (Resource.Id.menu_detail_start);
if (cart != null) {
menuSave.SetVisible (!File.Exists (cart.Filename));
menuDelete.SetVisible (File.Exists (cart.Filename));
menuResume.SetVisible (true);
menuResume.SetEnabled(File.Exists (cart.SaveFilename));
menuResume.Icon.SetAlpha(menuResume.IsEnabled ? 255 : 96);
menuStart.SetVisible (true);
menuStart.SetEnabled(File.Exists (cart.Filename));
menuStart.Icon.SetAlpha(menuStart.IsEnabled ? 255 : 96);
}
return base.OnCreateOptionsMenu(menu);
}
示例4: OnCreateOptionsMenu
public override bool OnCreateOptionsMenu(IMenu menu)
{
MenuInflater.Inflate (Resource.Menu.DetailMenu, menu);
_menuSave = menu.FindItem (Resource.Id.menu_detail_save);
_menuDelete = menu.FindItem (Resource.Id.menu_detail_delete);
_menuNavigate = menu.FindItem (Resource.Id.menu_detail_navigate);
_menuResume = menu.FindItem (Resource.Id.menu_detail_resume);
_menuStart = menu.FindItem (Resource.Id.menu_detail_start);
if (_cart != null) {
_menuSave.SetVisible (!File.Exists (_cart.Filename));
_menuDelete.SetVisible (File.Exists (_cart.Filename));
if (_cart.StartingLocationLatitude != 360.0 && _cart.StartingLocationLongitude != 360.0 && HasRouting())
_menuNavigate.SetEnabled(true);
else
_menuNavigate.SetEnabled(false);
_menuNavigate.Icon.SetAlpha(_menuNavigate.IsEnabled ? 204 : 96);
_menuResume.SetVisible (true);
_menuResume.SetEnabled(File.Exists (_cart.SaveFilename));
_menuResume.Icon.SetAlpha(_menuResume.IsEnabled ? 204 : 96);
_menuStart.SetVisible (true);
_menuStart.SetEnabled(File.Exists (_cart.Filename));
_menuStart.Icon.SetAlpha(_menuStart.IsEnabled ? 204 : 96);
}
return base.OnCreateOptionsMenu(menu);
}