本文整理汇总了C#中IMenuItem.SetChecked方法的典型用法代码示例。如果您正苦于以下问题:C# IMenuItem.SetChecked方法的具体用法?C# IMenuItem.SetChecked怎么用?C# IMenuItem.SetChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMenuItem
的用法示例。
在下文中一共展示了IMenuItem.SetChecked方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.item_pause_on_scroll:
pauseOnScroll = !pauseOnScroll;
item.SetChecked(pauseOnScroll);
ApplyScrollListener();
return true;
case Resource.Id.item_pause_on_fling:
pauseOnFling = !pauseOnFling;
item.SetChecked(pauseOnFling);
ApplyScrollListener();
return true;
default:
return base.OnOptionsItemSelected(item);
}
}
示例2: OnOptionsItemSelected
//@Override
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.menu_expandable_limit:
mLimited = !mLimited;
item.SetChecked(mLimited);
mExpandableListItemAdapter.setLimit(mLimited ? 2 : 0);
return true;
}
return base.OnOptionsItemSelected(item);
}
示例3: SelectDrawerItem
private void SelectDrawerItem(IMenuItem menuItem)
{
// this solves the problem of checking more than one item
// in the list across groups even when checkableBehavior is single on each group
// TODO: the problem with this solution is that it requires an update
// any time a new group is added to the menu, and that's maybe not so good
_navigationDrawerManager.SetGroupCheckable(Resource.Id.group_gear, (menuItem.GroupId == Resource.Id.group_gear), true);
_navigationDrawerManager.SetGroupCheckable(Resource.Id.group_meals, (menuItem.GroupId == Resource.Id.group_meals), true);
_navigationDrawerManager.SetGroupCheckable(Resource.Id.group_trips, (menuItem.GroupId == Resource.Id.group_trips), true);
_navigationDrawerManager.SetGroupCheckable(Resource.Id.group_settings, (menuItem.GroupId == Resource.Id.group_settings), true);
Android.Support.V4.App.Fragment fragment = null;
switch(menuItem.ItemId)
{
case Resource.Id.nav_gear_items_fragment:
fragment = new GearItemsFragment();
break;
case Resource.Id.nav_gear_systems_fragment:
fragment = new GearSystemsFragment();
break;
case Resource.Id.nav_gear_collections_fragment:
fragment = new GearCollectionsFragment();
break;
case Resource.Id.nav_meals_fragment:
fragment = new MealsFragment();
break;
case Resource.Id.nav_trip_itineraries_fragment:
fragment = new TripItinerariesFragment();
break;
case Resource.Id.nav_trip_plans_fragment:
fragment = new TripPlansFragment();
break;
case Resource.Id.nav_settings_fragment:
fragment = new SettingsFragment();
break;
case Resource.Id.nav_help_fragment:
fragment = new HelpFragment();
break;
case Resource.Id.nav_debug_fragment:
fragment = new DebugFragment();
break;
}
if(null != fragment) {
FragmentTransitionUtil.Transition(this, SupportFragmentManager.BeginTransaction(), Resource.Id.frame_content, fragment);
}
menuItem.SetChecked(true);
}
示例4: OnOptionsItemSelected
public override bool OnOptionsItemSelected (IMenuItem item)
{
switch (item.ItemId) {
case Resource.Id.show_tabs:
ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
item.SetChecked (true);
return true;
case Resource.Id.hide_tabs:
ActionBar.NavigationMode = ActionBarNavigationMode.Standard;
item.SetChecked (true);
return true;
case Resource.Id.stable_layout:
item.SetChecked (!item.IsChecked);
mContent.BaseSystemUiVisibility = item.IsChecked
? SystemUiFlags.LayoutFullscreen
| SystemUiFlags.LayoutStable
: SystemUiFlags.LayoutFullscreen;
return true;
}
return false;
}
示例5: OnOptionsItemSelected
//menu items handler
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.ViewTournamentInfoMenuRefresh:
gVar.lastViewTournamentInfoTabSelected = ActionBar.SelectedNavigationIndex;
this.Recreate();
return true;
case Resource.Id.ViewTournamentInfoMenuEdit:
if (item.IsChecked)
{
gVar.boolTournamentEditModeEnabled = false;
Toast.MakeText(this, this.GetString(Resource.String.tstEditDisabled), ToastLength.Long).Show();
item.SetChecked(false);
}
else
{
try
{
CheckAPIPermission();
item.SetChecked(true);
}
catch (WebException we)
{
WebExHandler(we);
}
}
return true;
case Resource.Id.ViewTournamentInfoMenuAddParticipant:
if (!gVar.boolTournamentEditModeEnabled)
Toast.MakeText(this, this.GetString(Resource.String.tstAddParticipantEditDisabled), ToastLength.Long).Show();
else if (jsonTournament["state"] != "pending")
Toast.MakeText(this, this.GetString(Resource.String.tstAddParticipantNotPending), ToastLength.Long).Show();
else if (jsonTournament["signup_cap"] != null)
{
if (jsonTournament["signup_cap"].ToString() == jsonTournament["participants_count"].ToString())
Toast.MakeText(this, this.GetString(Resource.String.tstParticipantCap), ToastLength.Long).Show();
else
{
var dialog2 = AddParticipantInfoDialog.Initalize(jsonTournament, this);
dialog2.Show(FragmentManager, "dialog");
}
}
else
{
var dialog2 = AddParticipantInfoDialog.Initalize(jsonTournament, this);
dialog2.Show(FragmentManager, "dialog");
}
return true;
case Resource.Id.ViewTournamentInfoMenuFav:
//add bookmarking code
var prefs = this.GetSharedPreferences("Challonger.preferences", FileCreationMode.Private);
var editor = prefs.Edit();
if (item.IsChecked)
{
if (prefs.Contains("favs"))
{
ICollection<string> favs = prefs.GetStringSet("favs", null);
foreach (object fav in favs)
Console.Out.WriteLine("FROM PREFS: " + fav.ToString());
favs.Remove(jsonTournament["id"].ToString());
editor.PutStringSet("favs", favs).Commit();
foreach (object fav in favs)
Console.Out.WriteLine("FROM PREFS AFTER: " + fav.ToString());
item.SetChecked(false);
}
}
else
{
if (prefs.Contains("favs"))
{
ICollection<string> favs = prefs.GetStringSet("favs", null);
foreach (object fav in favs)
Console.Out.WriteLine("FROM PREFS: " + fav.ToString());
favs.Add(jsonTournament["id"].ToString());
editor.PutStringSet("favs", favs).Commit();
foreach (object fav in favs)
Console.Out.WriteLine("FROM PREFS AFTER: " + fav.ToString());
item.SetChecked(true);
}
else
{
ICollection<string> favs = new List<string>();
favs.Add(jsonTournament["id"].ToString());
foreach (object fav in favs)
Console.Out.WriteLine("TO PREFS: " + fav.ToString());
editor.PutStringSet("favs", favs).Commit();
item.SetChecked(true);
}
}
return true;
}
return base.OnOptionsItemSelected(item);
}