Ejemplo n.º 1
0
        private void UnfollowFragment_MenuItemSelected(object sender, OnMenuItemSelectedEventArgs e)
        {
            switch (e.ItemId)
            {
            case Resource.Id.appbar_unfollow_item_refresh:
                DoTask(_account.RefreshAsync(), _refresh_adapter_data);
                break;

            case Resource.Id.appbar_unfollow_item_unfollowall:
                DoTask(
                    BatchUnfollowAsync(_account.Data.Unfollowers.Except(_adapter.Whitelist).ToArray()),
                    _refresh_adapter_data);
                break;

            case Resource.Id.appbar_unfollow_item_clear_whitelist:
                _adapter.Whitelist.Clear();
                ((IDataContainer)Activity).SaveData(_account.Data.User.Id + ".whitelist", _adapter.Whitelist);
                _refresh_adapter_data();
                break;

            case Resource.Id.appbar_unfollow_item_logout:
                var ig = ((IInstagramHost)Activity).Accounts;
                DoTask(ig.LogoutAccountAsync(_account), () =>
                {
                    ((IFragmentHost)Activity).PopFragment();
                });
                break;

            default:
                e.Finished = false;
                break;
            }
        }
Ejemplo n.º 2
0
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     if (HasOptionsMenu)
     {
         var e = new OnMenuItemSelectedEventArgs(item.ItemId);
         MenuItemSelected?.Invoke(this, e);
         if (e.Finished)
         {
             return(true);
         }
     }
     return(base.OnOptionsItemSelected(item));
 }
Ejemplo n.º 3
0
        private void AccountsFragment_MenuItemSelected(object sender, OnMenuItemSelectedEventArgs e)
        {
            switch (e.ItemId)
            {
            case Resource.Id.appbar_home_item_addaccount:
                PushFragment(new LoginFragment());
                ViewMode = RecyclerViewMode.Data;
                break;

            case Resource.Id.appbar_home_item_refresh:
                DoTask(
                    ((IInstagramHost)Activity).Accounts.RefreshAllAsync(),
                    Activity.Recreate);
                break;

            default:
                e.Finished = false;
                break;
            }
        }