Ejemplo n.º 1
0
        public void SaveChanges(NavigationService navigationService)
        {
            int reason = 0;

            if (this.Reason.Name == CommonResources.Group_BanReason_Spam)
            {
                reason = 1;
            }
            else if (this.Reason.Name == CommonResources.Group_BanReason_VerbalAbuse)
            {
                reason = 2;
            }
            else if (this.Reason.Name == CommonResources.Group_BanReason_StrongLanguage)
            {
                reason = 3;
            }
            else if (this.Reason.Name == CommonResources.Group_BanReason_IrrelevantMessages)
            {
                reason = 4;
            }
            this.SetInProgress(true, "");
            this.IsFormEnabled = false;
            GroupsService current1          = GroupsService.Current;
            long          communityId       = this._communityId;
            long          id                = this._user.id;
            int           durationUnixTime  = this.DurationUnixTime;
            int           reason1           = reason;
            string        comment           = this.Comment;
            bool?         isCommentVisible1 = this.IsCommentVisible;
            bool          flag1             = true;
            int           num1              = isCommentVisible1.GetValueOrDefault() == flag1 ? (isCommentVisible1.HasValue ? 1 : 0) : 0;
            Action <BackendResult <int, ResultCode> > callback = (Action <BackendResult <int, ResultCode> >)(result => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (result.ResultCode == ResultCode.Succeeded)
                {
                    this._user.ban_info.date = Extensions.DateTimeToUnixTimestamp(DateTime.Now.ToUniversalTime(), true);
                    this._user.ban_info.end_date = this.DurationUnixTime;
                    this._user.ban_info.reason = reason;
                    this._user.ban_info.comment = this.Comment;
                    BlockInformation banInfo = this._user.ban_info;
                    bool?isCommentVisible2 = this.IsCommentVisible;
                    bool flag2 = true;
                    int num2 = (isCommentVisible2.GetValueOrDefault() == flag2 ? (isCommentVisible2.HasValue ? 1 : 0) : 0) != 0 ? 1 : 0;
                    banInfo.comment_visible = num2;
                    this._user.ban_info.admin_id = AppGlobalStateManager.Current.LoggedInUserId;
                    this._user.ban_info.manager = AppGlobalStateManager.Current.GlobalState.LoggedInUser;
                    EventAggregator current2 = EventAggregator.Current;
                    CommunityBlockChanged communityBlockChanged = new CommunityBlockChanged();
                    communityBlockChanged.CommunityId = this._communityId;
                    communityBlockChanged.User = this._user;
                    int num3 = this._manager != null ? 1 : 0;
                    communityBlockChanged.IsEditing = num3 != 0;
                    current2.Publish((object)communityBlockChanged);
                    if (!this._isEditing && !this._isOpenedWithoutPicker)
                    {
                        navigationService.RemoveBackEntry();
                    }
                    Navigator.Current.GoBack();
                }
                else
                {
                    this.SetInProgress(false, "");
                    this.IsFormEnabled = true;
                    GenericInfoUC.ShowBasedOnResult((int)result.ResultCode, "", null);
                }
            })));

            current1.BlockUser(communityId, id, durationUnixTime, reason1, comment, num1 != 0, callback);
        }