private void createStatusAndPost() { string tryAgainMessage = "please try again"; string problemMessage = string.Empty; StatusFromUser status = StatusFactory.Create(this.textBoxStatus.Text, this.dateTimePicker.Value); this.Invoke(new Action(() => emptyText(this.textBoxStatus))); try { status.WriteToLogAndPost(); } catch (Exception e) { problemMessage = string.Format("{0}{1}{2}", e.Message, Environment.NewLine, tryAgainMessage); MessageBox.Show(problemMessage); } }
private void tryToPostHoroscope() { string doneMessage = "Done!"; try { StatusFromUser horoscope = StatusFactory.Create(textBox1.Text, DateTime.Now); horoscope.Post(); MessageBox.Show(doneMessage); } catch (Exception e) { MessageBox.Show(e.Message); } // in order not to post again this.buttonPostHoroscope.Enabled = false; }