Пример #1
0
 private void actualizar()
 {
     try
     {
         noticias = Noticia.listaNoticias();
         mostrarTablon();
     }
     catch (Exception ex)
     {
     }
 }
Пример #2
0
        private void prepararNoticias()
        {
            lNoticias.Visible = false;
            panel1.Visible    = false;
            panel2.Visible    = false;
            panel3.Visible    = false;

            try
            {
                List <Noticia> lista = Noticia.listaNoticias();

                int len = lista.Count();

                if (len > 0)
                {
                    lNoticias.Visible = true;
                    panel1.Visible    = true;

                    idNoticia1  = lista[0].id;
                    label2.Text = lista[0].titulo;
                    try
                    {
                        label2.Text = lista[0].titulo.Substring(0, 28) + "...";
                    } catch (Exception ex)
                    {
                    }

                    label3.Text = Regex.Replace(lista[0].texto, ".{42}", "$0\n");
                    try
                    {
                        label3.Text = label3.Text.Substring(0, 126) + "...";
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (len > 1)
                {
                    panel2.Visible = true;
                    idNoticia2     = lista[1].id;

                    label5.Text = lista[1].titulo;
                    try
                    {
                        label5.Text = lista[1].titulo.Substring(0, 28) + "...";
                    }
                    catch (Exception ex)
                    {
                    }

                    label4.Text = Regex.Replace(lista[1].texto, ".{42}", "$0\n");
                    try
                    {
                        label4.Text = label4.Text.Substring(0, 126) + "...";
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (len > 2)
                {
                    panel3.Visible = true;
                    idNoticia3     = lista[2].id;

                    label7.Text = lista[2].titulo;
                    try
                    {
                        label7.Text = lista[2].titulo.Substring(0, 28) + "...";
                    }
                    catch (Exception ex)
                    {
                    }

                    label6.Text = Regex.Replace(lista[2].texto, ".{42}", "$0\n");
                    try
                    {
                        label6.Text = label6.Text.Substring(0, 126) + "...";
                    }
                    catch (Exception ex)
                    {
                    }
                }
            } catch (Exception exG)
            {
            }
        }