Beispiel #1
0
        private async void SendExecute()
        {
            if (_item != null && _full != null && !string.Equals(_about, _full.About))
            {
                var response = await ProtoService.EditAboutAsync(_item, _about);

                if (response.IsSucceeded)
                {
                    _full.About = _about;
                    _full.RaisePropertyChanged(() => _full.About);
                }
                else
                {
                    // TODO:
                    return;
                }
            }

            if (_item != null && !string.Equals(_title, _item.Title))
            {
                var response = await ProtoService.EditTitleAsync(_item, _title);

                if (response.IsSucceeded)
                {
                    _item.Title = _title;
                    _item.RaisePropertyChanged(() => _item.Title);
                }
                else
                {
                    // TODO:
                    return;
                }
            }

            NavigationService.GoBack();
        }
Beispiel #2
0
        private async void SendExecute()
        {
            var about = _about.Format();
            var title = _title.Trim();

            if (_item != null && _full != null && !string.Equals(about, _full.About))
            {
                var response = await ProtoService.EditAboutAsync(_item, about);

                if (response.IsSucceeded)
                {
                    _full.About = about;
                    _full.RaisePropertyChanged(() => _full.About);
                }
                else
                {
                    // TODO:
                    return;
                }
            }

            if (_item != null && !string.Equals(title, _item.Title))
            {
                var response = await ProtoService.EditTitleAsync(_item, title);

                if (response.IsSucceeded)
                {
                    _item.Title = title;
                    _item.RaisePropertyChanged(() => _item.Title);
                }
                else
                {
                    // TODO:
                    return;
                }
            }

            if (_item != null && _isSignatures != _item.IsSignatures)
            {
                var response = await ProtoService.ToggleSignaturesAsync(_item.ToInputChannel(), _isSignatures);

                if (response.IsSucceeded)
                {
                }
                else
                {
                    // TODO:
                    return;
                }
            }

            if (_item != null && _full != null && _isHiddenPreHistory != _full.IsHiddenPreHistory)
            {
                var response = await ProtoService.TogglePreHistoryHiddenAsync(_item.ToInputChannel(), _isHiddenPreHistory);

                if (response.IsSucceeded)
                {
                }
                else
                {
                    // TODO:
                    return;
                }
            }

            NavigationService.GoBack();
        }
        private async void SendExecute()
        {
            var item = _item;

            if (item == null)
            {
                return;
            }

            var full = _full;

            if (full == null)
            {
                return;
            }

            var about    = _about.Format();
            var title    = _title.Trim();
            var username = _isPublic ? _username?.Trim() : null;

            if (item != null && !string.Equals(username, item.Username))
            {
                var response = await ProtoService.UpdateUsernameAsync(item.ToInputChannel(), username);

                if (response.IsSucceeded)
                {
                    item.Username    = username;
                    item.HasUsername = username != null;
                    item.RaisePropertyChanged(() => item.Username);
                    item.RaisePropertyChanged(() => item.HasUsername);
                }
            }

            if (item != null && !string.Equals(title, item.Title))
            {
                var response = await ProtoService.EditTitleAsync(item, title);

                if (response.IsSucceeded)
                {
                    item.Title = title;
                    item.RaisePropertyChanged(() => item.Title);
                }
                else
                {
                    // TODO:
                    return;
                }
            }

            if (full != null && !string.Equals(about, full.About))
            {
                var response = await ProtoService.EditAboutAsync(item, about);

                if (response.IsSucceeded)
                {
                    full.About = about;
                    full.RaisePropertyChanged(() => full.About);
                }
                else
                {
                    // TODO:
                    return;
                }
            }

            if (_isSignatures != item.IsSignatures)
            {
                var response = await ProtoService.ToggleSignaturesAsync(item.ToInputChannel(), _isSignatures);

                if (response.IsSucceeded)
                {
                }
                else
                {
                    // TODO:
                    return;
                }
            }

            if (full != null && _isHiddenPreHistory != full.IsHiddenPreHistory)
            {
                var response = await ProtoService.TogglePreHistoryHiddenAsync(item.ToInputChannel(), _isHiddenPreHistory);

                if (response.IsSucceeded)
                {
                }
                else
                {
                    // TODO:
                    return;
                }
            }

            NavigationService.GoBack();
        }