本文整理汇总了C#中IMenuItem.SetVisible方法的典型用法代码示例。如果您正苦于以下问题:C# IMenuItem.SetVisible方法的具体用法?C# IMenuItem.SetVisible怎么用?C# IMenuItem.SetVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMenuItem
的用法示例。
在下文中一共展示了IMenuItem.SetVisible方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreateOptionsMenu
public override bool OnCreateOptionsMenu (Android.Views.IMenu menu)
{
MenuInflater.Inflate (Resource.Menu.main_screen, menu);
_addAlarmMenuButton = menu.FindItem (Resource.Id.add_alarm);
_acceptMenuButton = menu.FindItem (Resource.Id.accept);
_alarmNameMenuItem = menu.FindItem (Resource.Id.alarm_name);
_deleteAlarmMenuItem = menu.FindItem (Resource.Id.delete);
_disableAlarmMenuItem = menu.FindItem (Resource.Id.switch_button);
_alarmRadiusMenuItem = menu.FindItem (Resource.Id.alarm_radius);
_settingsMenuItem = menu.FindItem (Resource.Id.action_settings);
_alarmNameEditText = MenuItemCompat.GetActionView (_alarmNameMenuItem) as EditText;
_alarmNameEditText.Hint = Resources.GetString (Resource.String.alarm_name);
_alarmNameEditText.SetWidth (Resources.GetDimensionPixelSize (Resource.Dimension.abc_search_view_preferred_width));
_enableAlarmToggleButton = MenuItemCompat.GetActionView (_disableAlarmMenuItem) as ToggleButton;
_enableAlarmToggleButton.CheckedChange += AlarmEnabledChange;
_alarmRadiusSpinner = MenuItemCompat.GetActionView (_alarmRadiusMenuItem) as Spinner;
var adapter = new ArrayAdapter (this, Resource.Layout.support_simple_spinner_dropdown_item,
Android.Resource.Id.Text1, Constants.AlarmRadiusValues.Select (r => string.Format ("{0} m", r)).ToList ());
adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
_alarmRadiusSpinner.Adapter = adapter;
_alarmRadiusSpinner.ItemSelected += (s, e) => RedrawAddCircle ();
ManageMenuItemsVisibilityForMode ();
_addAlarmMenuButton.SetVisible (_isGooglePlayServicesAvailable == ConnectionResult.Success);
return base.OnCreateOptionsMenu (menu);
}
示例2: OnCreateOptionsMenu
public override void OnCreateOptionsMenu (IMenu menu, MenuInflater menuInflater) {
menuInflater.Inflate (Resource.Layout.order_menu, menu);
favourite = menu.FindItem (Resource.Id.fav);
favourite.SetVisible (false);
base.OnCreateOptionsMenu (menu, menuInflater);
}
示例3: OnCreateOptionsMenu
public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
{
inflater.Inflate (Resource.Menu.GameDetailScreenMenu, menu);
menuMap = menu.FindItem (Resource.Id.menu_screen_detail_map);
if (activeObject != null && activeObject is Thing && !ctrl.Engine.VisibleInventory.Contains((Thing)activeObject)) {
menuMap.SetVisible (true);
} else {
menuMap.SetVisible(false);
}
base.OnCreateOptionsMenu(menu, inflater);
}
示例4: OnCreateOptionsMenu
public override bool OnCreateOptionsMenu(IMenu menu)
{
MenuInflater.Inflate (Resource.Menu.CartridgesMenu, menu);
_menuSearch = menu.FindItem (Resource.Id.menu_cartridges_search);
_menuSettings = menu.FindItem (Resource.Id.menu_cartridges_settings);
_menuAbout = menu.FindItem (Resource.Id.menu_cartridges_about);
_menuSearch.SetVisible(false);
return base.OnCreateOptionsMenu(menu);
}
示例5: OnCreate
// int SHOT_TYPE;
protected async override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.screenshot_activity);
mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
SetSupportActionBar(mToolbar);
SupportActionBar.SetDisplayShowHomeEnabled(true);
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.Title = GetString(Resource.String.action_screenshot);
iView = FindViewById<ImageView>(Resource.Id.ivScreenShot);
iView.Click += (sender, e) =>
{
var content = GetBytesFromDrawable(iView.Drawable);
//make sure we have something to show in the first place
if (content != null && iView.Drawable != defaultImage)
{
//there is no external storage available, Gallery cannot show internal cache image
if (FileSystem.GetTmpDir(this) == CacheDir.AbsolutePath)
return;
try
{
if (SaveFile(GetTmpFileName(), content))
{
Intent intent = new Intent();
intent.SetAction(Intent.ActionView);
intent.SetDataAndType(Android.Net.Uri.Parse("file://" + GetTmpFileName()), "image/*");
StartActivity(intent);
}
}
catch (Exception ex)
{
Log.Error(TAG, string.Format("Error launching image view intent! {0}", ex.Message));
}
}
};
pbScreenShot = FindViewById<ProgressBar>(Resource.Id.pbScreenShot);
defaultImage = iView.Drawable;
layoutPb = FindViewById<LinearLayout>(Resource.Id.layoutPb);
bottomToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar_bottom);
bottomToolbar.InflateMenu(Resource.Menu.menu_screenshot);
screenshotAll = bottomToolbar.Menu.FindItem(Resource.Id.action_screenshot_all);
screenshotOSD = bottomToolbar.Menu.FindItem(Resource.Id.action_screenshot_osd);
screenshotPicture = bottomToolbar.Menu.FindItem(Resource.Id.action_screenshot_picture);
saveMenu = bottomToolbar.Menu.FindItem(Resource.Id.action_save);
saveMenu.SetVisible(FileSystem.IsExternalStorageWritable());
bottomToolbar.MenuItemClick += (sender, e) =>
{
if (e.Item.ItemId == Resource.Id.action_screenshot_all)
{
TakeScreenshot(ScreenshotType.All);
e.Handled = true;
}
else if (e.Item.ItemId == Resource.Id.action_screenshot_osd)
{
TakeScreenshot(ScreenshotType.Osd);
e.Handled = true;
}
else if (e.Item.ItemId == Resource.Id.action_screenshot_picture)
{
TakeScreenshot(ScreenshotType.Picture);
e.Handled = true;
}
else if (e.Item.ItemId == Resource.Id.action_save)
{
SaveToDisk();
e.Handled = true;
}
};
//bundle = this.Intent.Extras;
//SHOT_TYPE = bundle.GetInt("SHOT_TYPE");
if (bundle != null)
{
var cachedScreenshotPath = bundle.GetString(cachedImage);
if (!string.IsNullOrEmpty(cachedScreenshotPath))
{
var cachedScreenShot = LoadTmpFile();
if (cachedScreenShot != null)
{
layoutPb.Visibility = ViewStates.Gone;
iView.Visibility = ViewStates.Visible;
var bitmap = CreateBitmapFromBytes(cachedScreenShot);
iView.SetImageBitmap(bitmap);
}
}
}
else
{
TakeScreenshot(ScreenshotType.All);
}
}
示例6: 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);
}
示例7: SetPreviousButton
/// <summary>
/// A method for setting the Next Button
/// </summary>
public virtual void SetPreviousButton(IMenuItem prev)
{
Previous = prev;
if (Previous != null)
{
// Update visibility base on position
if (Selected <= 0)
Previous.SetVisible(false);
// Set the buttons listner to this
Previous.SetOnMenuItemClickListener(this);
}
}
示例8: SetNextButton
/// <summary>
/// A method for setting the Next Button
/// </summary>
public virtual void SetNextButton(IMenuItem next)
{
Next = next;
if (Next != null)
{
// Update visibility base on position
if (Selected >= Count - 1)
Next.SetVisible(false);
// Set the buttons listner to this
Next.SetOnMenuItemClickListener(this);
}
}
示例9: 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);
}
示例10: OnPrepareOptionsMenu
public override void OnPrepareOptionsMenu (IMenu menu)
{
menuConnection = menu.FindItem (Resource.Id.menuConnection);
menuSettings = menu.FindItem (Resource.Id.menuSettings);
menuRefresh = menu.FindItem(Resource.Id.menuRefresh);
menuUpload = menu.FindItem(Resource.Id.menuUpload);
menuFormat = menu.FindItem(Resource.Id.menuFormat);
menuConnection.SetVisible(false);
menuSettings.SetVisible(false);
menuRefresh.SetVisible(true);
//menuUpload.SetVisible(true);//upload is not supported
menuUpload.SetVisible(false);
menuFormat.SetVisible(true);
if(adapter.SelectedItems.Count != 0){
foreach(FileItem item in adapter.SelectedItems){
item.Checked = false;
}
adapter.SelectedItems.Clear();
adapter.NotifyDataSetChanged();
}
base.OnPrepareOptionsMenu(menu);
}
示例11: OnCreateOptionsMenu
public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
{
inflater.Inflate (Resource.Menu.GameListScreenMenu, menu);
menuMap = menu.FindItem (Resource.Id.menu_screen_list_map);
if (type == ScreenTypes.Locations || type == ScreenTypes.Items) {
menuMap.SetVisible (true);
} else {
menuMap.SetVisible(false);
}
base.OnCreateOptionsMenu(menu, inflater);
}