private void HandleSetPopupMenu(CrawlerSetViewModel item, CrawlerSetHolder holder) { var menuBuilder = new MenuBuilder(Activity); menuBuilder.Add(0, 0, 0, AppResources.Generic_Delete).SetIcon(Resource.Drawable.icon_delete); if (item.IsFavourite) { menuBuilder.Add(0, 1, 0, AppResources.Item_CrawlerSet_Unfavourite).SetIcon(Resource.Drawable.icon_star_off); } else { menuBuilder.Add(0, 2, 0, AppResources.Item_CrawlerSet_Favourite).SetIcon(Resource.Drawable.icon_star); } menuBuilder.SetCallback(new MenuCallback((sender, menuItem) => { if (menuItem.ItemId == 0) { ViewModel.RemoveSet(item); } else if (menuItem.ItemId == 1) { item.IsFavourite = false; } else if (menuItem.ItemId == 2) { item.IsFavourite = true; } })); var menuPopupHelper = new MenuPopupHelper(Context, menuBuilder); menuPopupHelper.SetAnchorView(holder.MoreButton); menuPopupHelper.SetForceShowIcon(true); menuPopupHelper.Show(); }
static void Main(string[] args) { MenuBuilder menuBuilder = new MenuBuilder(); CarFactory carFactory = new CarFactory(); ItemsGenerator itemsGenerator = new ItemsGenerator(); menuBuilder.Add(new AddItemMenuItem(itemsGenerator, carFactory)); menuBuilder.Execute(); }
private void HandlePopupMenu(View view, FeedItemViewModel viewModel) { var menuBuilder = new MenuBuilder(Activity); menuBuilder.Add(0, 0, 0, AppResources.Item_Feed_AddIgnore).SetIcon(Resource.Drawable.icon_stop); if (!viewModel.IsWatched) { menuBuilder.Add(0, 1, 0, AppResources.Item_Feed_AddWatched).SetIcon(Resource.Drawable.icon_eye); } else { menuBuilder.Add(0, 2, 0, AppResources.Item_Feed_RemoveWatched).SetIcon(Resource.Drawable.icon_eye_off); } menuBuilder.SetCallback(new MenuCallback((sender, menuItem) => { if (menuItem.ItemId == 0) { viewModel.IgnoreItemCommand.Execute(null); } else if (menuItem.ItemId == 1) { viewModel.WatchItemCommand.Execute(null); } else if (menuItem.ItemId == 2) { viewModel.UnwatchItemCommand.Execute(null); } })); var menuPopupHelper = new MenuPopupHelper(Context, menuBuilder); menuPopupHelper.SetAnchorView(view); menuPopupHelper.SetForceShowIcon(true); menuPopupHelper.Show(); }
private void HandleJumpToPopup(View obj) { var menuBuilder = new MenuBuilder(Activity); int i = 0; int j = ViewModel.ContainsAggregate ? 0 : 1; foreach (var tabEntry in ViewModel.FeedTabEntries) { menuBuilder.Add(0, i++, 0, tabEntry.Name).SetIcon(Util.IndexToIconResource(j++)); } menuBuilder.SetCallback(new MenuCallback((sender, menuItem) => { ViewPager.SetCurrentItem(menuItem.ItemId, true); })); var menuPopupHelper = new MenuPopupHelper(Context, menuBuilder); menuPopupHelper.SetAnchorView(JumpToButton); menuPopupHelper.SetForceShowIcon(true); menuPopupHelper.Show(); }