コード例 #1
0
        public void Next()
        {
            if (!CanCreateChannel)
            {
                return;
            }

            IsWorking = true;
            NotifyOfPropertyChange(() => CanCreateChannel);

            // 1 broadcast
            // 2 mega group
            MTProtoService.CreateChannelAsync(new TLInt(1), new TLString(Title), new TLString(About),
                                              result => Execute.BeginOnUIThread(() =>
            {
                var updates = result as TLUpdates;
                if (updates != null)
                {
                    var channel = updates.Chats.FirstOrDefault() as TLChannel;
                    if (channel != null)
                    {
                        if (_photo != null)
                        {
                            ContinueUploadingPhoto(channel);
                        }
                        else
                        {
                            if (_uploadingPhoto)
                            {
                                _uploadingCallback = () => ContinueUploadingPhoto(channel);
                            }
                            else
                            {
                                ContinueNextStep(channel);
                            }
                        }
                    }
                }
            }),
                                              error => Execute.BeginOnUIThread(() =>
            {
                IsWorking = false;
                NotifyOfPropertyChange(() => CanCreateChannel);

                if (error.CodeEquals(ErrorCode.BAD_REQUEST))
                {
                    if (error.TypeEquals(ErrorType.CHANNELS_TOO_MUCH))
                    {
                        MessageBox.Show(AppResources.ChannelsTooMuch, AppResources.Error, MessageBoxButton.OK);
                    }
                }

                Execute.ShowDebugMessage("channels.createChannel error " + error);
            }));
        }
コード例 #2
0
        public void Next()
        {
            if (!CanCreateChannel)
            {
                return;
            }

            IsWorking = true;
            NotifyOfPropertyChange(() => CanCreateChannel);

#if LAYER_41
            // 1 broadcast
            // 2 mega group
            MTProtoService.CreateChannelAsync(new TLInt(2), new TLString(Title), new TLString(About),
#else
            MTProtoService.CreateChannelAsync(new TLInt(1), new TLString(Title), new TLString(About), new TLVector <TLInputUserBase>(),
#endif
                                              result => Execute.BeginOnUIThread(() =>
            {
                var updates = result as TLUpdates;
                if (updates != null)
                {
                    var channel = updates.Chats.FirstOrDefault() as TLChannel;
                    if (channel != null)
                    {
                        if (_photo != null)
                        {
                            ContinueUploadingPhoto(channel);
                        }
                        else
                        {
                            if (_uploadingPhoto)
                            {
                                _uploadingCallback = () => ContinueUploadingPhoto(channel);
                            }
                            else
                            {
                                ContinueNextStep(channel);
                            }
                        }
                    }
                }
            }),
                                              error => Execute.BeginOnUIThread(() =>
            {
                IsWorking = false;
                NotifyOfPropertyChange(() => CanCreateChannel);

                Execute.ShowDebugMessage("channels.createChannel error " + error);
            }));
        }