1
I’m trying to monitor the latest row bank MySQL and when this is changed I will display a message, however I am having doubts on how to monitor with C code#.
I’ve managed to requisition the last row from time to time, but I would like to display it only if it is different from the previous one.
This first part starts my counter along with the Load form:
private void AnteSala_Load(object sender, EventArgs e)
{
    var timer = new System.Timers.Timer
    {
        Interval = 2 * 60 * 1000,
        SynchronizingObject = this
    };
    timer.Elapsed += delegate
    {
        //MessageBox.Show(@"tentou update check 1");
        ReadInformationFromeMessage();
        //MessageBox.Show(@"passou 1");
    };
    timer.Start();
}
This second half takes my last row bank message:
private void ReadInformationFromeMessage()
{
    try
    {
        const string mySelectQuery =
            "select * from send_eMessages order by id desc limit 1";
        var myCommand = new MySqlCommand(mySelectQuery, ConexaoBancoMySql.GetConexao());
        var reader = myCommand.ExecuteReader();
        while (reader.Read())
        {
            var eMessage = (reader.GetString("eMessage"));
            Invoke((MethodInvoker)delegate
            {
               var pop = new PopupNotifier
               {
                   //escopo de mensagem
                   TitleText = "*  Informativo de Segurança  *",
                   ContentText = "" + eMessage,
                   //fim do escopo de mensagem
                   TitleFont = new Font("Tahoma", 12),
                   //cor do titulo do form
                   TitleColor = Color.White,
                   BodyColor = System.Drawing.Color.FromArgb(0, 75, 0),
                   //contorno do form
                   BorderColor = System.Drawing.Color.FromArgb(0, 255, 0),
                   //cor da fonte do aviso
                   ContentColor = System.Drawing.Color.FromArgb(255, 255, 255),
                   //tamanho da fonte
                   ContentFont = new System.Drawing.Font("Tahoma", 12F),
                   //cor da fonte do aviso quando mouse em cima
                   ContentHoverColor = System.Drawing.Color.FromArgb(255, 255, 255),
                   //centralizacao da mensagem no form 
                   ImagePadding = new Padding(0),
                   ContentPadding = new Padding(10),
                   Delay = 15000,
                   GradientPower = 150,
                   //tamanho da borda superior
                   HeaderHeight = 1,
                   Scroll = true,
                   ShowCloseButton = true,
                   ShowGrip = true,
                   ShowOptionsButton = false,                      
               };
                pop.Popup();
           });
        }
    }
    catch (MySqlException ex)
    {
        MessageBox.Show(ex.ToString());
    }
    finally
    {
        ConexaoBancoMySql.FecharConexao();
    }
}
						
All right @caio porem ja tive respostas no overflow , even so thanks
– Andre Breviglieri