Ejemplo n.º 1
0
        private async void buttonSend_Click(object sender, EventArgs e)
        {
            if (_isPostponed)
            {
                _postponedMaster.AddMessage(new PostponedTelegramMessage(_message, _publicationTime));
                MessageBox.Show($@"Повідомлення буде опубліковано о {_publicationTime:t}");
                buttonSend.Image = new Bitmap(@"...\...\img\sent.png");

                _isPostponed = false;
            }
            else
            {
                try
                {
                    buttonSend.Enabled = false;
                    MessageBox.Show(await _message.Send());
                }
                catch (Exception exception)
                {
                    MessageBox.Show($@"Сталась помилка:{Environment.NewLine}{exception.Message}");
                }
                finally
                {
                    richTextBoxInputText.Focus();
                    buttonSend.Enabled = true;
                    if (!(_message.Content is SimpleText))
                    {
                        ToSimpleTextMode();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public async void Check()
        {
            try
            {
                await Message.Send();

                Validation = true;
            }
            catch (Exception e)
            {
                Validation = false;
            }
        }