コード例 #1
0
 private void timer_callBack(object state)
 {
     try
     {
         string nextPhrase = PhrasesManager.ObtainNextPhrase();
         DrawText(nextPhrase, new Font("Arial", 34), Color.Red, Color.Black);
         Jarvis.sendTweet(nextPhrase);
     }
     catch (Exception ex)
     {
         File.WriteAllText("log_process.err", ex.Message);
         MessageBox.Show("Error a la hora de obtener la nueva frase.");
     }
     finally
     {
         timer.Change(tiempoEspera, TimeSpan.Zero);
     }
 }
コード例 #2
0
        /// <summary>
        /// This method add a new phrase to the collection.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Boton_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(textBox.Text))
            {
                if (!(textBox.Text.Length > 280))
                {
                    PhrasesManager.SaveNewPhrase(textBox.Text, string.Empty);
                }
                else
                {
                    MessageBox.Show("Cantidad maxima de caracteres superada - Max characters count exceded..");
                }
            }
            else
            {
                MessageBox.Show("Debe rellenar el campo de la frase - You must fill the field to add a phrase.");
            }

            LoadPhrases();
        }