private async void btnSharesBoost_Click(object sender, RoutedEventArgs e)
        {
            btnSharesBoost.IsEnabled = false;

            try
            {
                for (int i = 0; i < Convert.ToInt32(txtSharesCount.Value); ++i)
                {
                    await PostApi.AddRepost(Convert.ToInt32(txtPostsPostId.Value))
                    .ConfigureAwait(true);
                }

                await DialogManager.ShowDialog("Success", "BOOOOSTED")
                .ConfigureAwait(true);
            }
            catch (Exception ex)
            {
                await DialogManager.ShowDialog("Some rtarded shit happened", ex.Message)
                .ConfigureAwait(true);
            }
            finally
            {
                btnSharesBoost.IsEnabled = true;
            }
        }
示例#2
0
        public async Task Share()
        {
            ShareButton.IsEnabled = false;

            try
            {
                if (CurrentPostData.Id == -1)
                {
                    return;
                }

                var link = MemenimProtocolApiUtils.GetPostLink(
                    CurrentPostData.Id);

                Clipboard.SetText(link);

                var result = await PostApi.AddRepost(
                    SettingsManager.PersistentSettings.CurrentUser.Token,
                    CurrentPostData.Id)
                             .ConfigureAwait(true);

                if (result.IsError)
                {
                    await DialogManager.ShowErrorDialog(result.Message)
                    .ConfigureAwait(true);

                    return;
                }

                ++CurrentPostData.Shares;
            }
            finally
            {
                ShareButton.IsEnabled = true;
            }
        }
        public async Task Share()
        {
            stShares.IsEnabled = false;

            Clipboard.SetText($"memenim://app/post/id/{CurrentPostData.Id}");

            var result = await PostApi.AddRepost(
                SettingsManager.PersistentSettings.CurrentUser.Token,
                CurrentPostData.Id)
                         .ConfigureAwait(true);

            if (result.IsError)
            {
                await DialogManager.ShowErrorDialog(result.Message)
                .ConfigureAwait(true);

                stShares.IsEnabled = true;
                return;
            }

            ++CurrentPostData.Shares;

            stShares.IsEnabled = true;
        }