Exemple #1
0
        public void EditChannelTitleAsync(TLChannel channel, TLString title, System.Action callback)
        {
            if (TLString.Equals(title, channel.Title, StringComparison.Ordinal))
            {
                callback.SafeInvoke();
                return;
            }

            IsWorking = true;
            MTProtoService.EditTitleAsync(channel, title,
                                          result => Execute.BeginOnUIThread(() =>
            {
                IsWorking = false;

                var updates = result as TLUpdates;
                if (updates != null)
                {
                    var updateNewMessage = updates.Updates.FirstOrDefault(x => x is TLUpdateNewChannelMessage) as TLUpdateNewChannelMessage;
                    if (updateNewMessage != null)
                    {
                        EventAggregator.Publish(updateNewMessage.Message);
                    }
                }

                callback.SafeInvoke();
            }),
                                          error => Execute.BeginOnUIThread(() =>
            {
                Execute.ShowDebugMessage("channels.editTitle error " + error);

                IsWorking = false;

                if (error.CodeEquals(ErrorCode.BAD_REQUEST) &&
                    error.TypeEquals(ErrorType.CHAT_NOT_MODIFIED))
                {
                }
                callback.SafeInvoke();
            }));
        }