示例#1
0
        private void BanClick(object o, EventArgs e)
        {
            if (WhichSelected == -1)
            {
                return;
            }

            if (selectedAccount.Can((uint)Permissions.BANNED))
            {
                banButton.Text = "Ban";
                Toast.MakeText(this, $"Unbanned {selectedAccount.Username}", ToastLength.Long).Show();
                RequestSender.UnbanAccount(WhichSelected);
                selectedAccount.RemovePermission(Permissions.BANNED);
                WhichBannedTitle.Text = "";
            }
            else
            {
                banButton.Text = "Unban";
                Toast.MakeText(this, $"Banned {selectedAccount.Username}", ToastLength.Long).Show();
                RequestSender.BanAccount(WhichSelected);
                selectedAccount.AddPermission(Permissions.BANNED);
                WhichBannedTitle.Text = "Banned";
            }
        }