예제 #1
0
        private void tsmiPublicate_ClickAsync(object sender, EventArgs e)
        {
            VkPublicationDTO publication = (VkPublicationDTO)dgvPosts.SelectedRows[0].Tag;

            TelegramPublicationDTO telegramPost = PublicationCreator.CreateTelegramPublication(publication);

            if (telegramPost == null)
            {
                MessageBox.Show("Ошибка публикации.");
                return;
            }
            else if (telegramPost.Error.Length > 0)
            {
                MessageBox.Show(telegramPost.Error);
                return;
            }
            else if (telegramPost.CanPublicate == false)
            {
                MessageBox.Show("Публикация отклонена. Не соответствует фильтру.");
                return;
            }

            bool ExistsImage = false;

            if (telegramPost.PhotoUrl != null && telegramPost.PhotoUrl != string.Empty)
            {
                ExistsImage = true;
            }

            TelegramAPI.SendPublicationAsync(telegramPost, ExistsImage);
        }