Ejemplo n.º 1
0
        /// <summary>
        /// Juste des couleurs pour décoration de l'affichage des contacts, ces
        /// couleurs sont choisis aléatoirements
        /// </summary>
        // Color[] clr = new Color[] { Color.Aqua, Color.Azure, Color.Chocolate, Color.FloralWhite, Color.Gold,Color.Teal };
        // La fonction qui charge les contacts de la base de données
        // Fait un formatage de l'affichage des contacts
        private List <Contact> load_contact()
        {
            Database       db    = new Database("wa.db");
            int            j     = 0;
            List <Contact> liste = new List <Contact>();

            liste = db.ListeContacts();
            panel4.BringToFront();
            while (j < liste.Count())
            {
                Contact c = new Contact();
                c = liste.ElementAt(j);
                // dataGridView1.Rows.Add(c.getDisplay_name(), "0" + c.getNumber(), c.getStatus());
                contact_item_list cc = new contact_item_list();
                cc.setNom(c.getDisplay_name());
                cc.setNumero(c.getStatus());
                cc.setColor(Color.White);
                cc.setTime("+2120" + c.getNumber().ToString());
                cc.Location = new System.Drawing.Point(0, 65 * j);
                panel4.Controls.Add(cc);
                j++;
            }
            db.closeConnection();
            messageContrl1.label4.Text = liste.Count().ToString();
            return(liste);
        }
Ejemplo n.º 2
0
        // Charge la liste de chats de la base de données
        private void load_chatList(List <ChatList> chListe)
        {
            Database db = new Database();
            //var chListe = db.listChat();
            int    j     = 0;
            String verif = "";

            panel5.Controls.Clear();
            this.panel5.Controls.Add(btnSearch());
            this.panel5.Controls.Add(textBox());
            while (j < chListe.Count())
            {
                ChatList chL = new ChatList();
                chL = chListe.ElementAt(j);
                //  chat_cpnt cc = new chat_cpnt();
                contact_item_list cc = new contact_item_list();
                List <Contact>    lc = new List <Contact>();

                liste = db.listMessages(chL.getKey_remote_jid());
                cc.setNom(chL.getKey_remote_jid());
                cc.setNumero(liste.ElementAt(liste.Count() - 1).getData());


                DateTime t = convertTime(long.Parse(chL.getTimestamp().ToString()) / 1000);
                verif = String.Format("{0:dd/MM/yyyy}", t);
                msg   = chL.getKey_remote_jid();
                cc.setTime(verif);
                cc.Location = new System.Drawing.Point(0, 63 * j + 45);
                cc.setColor(Color.White);

                cc.lbl_t().Click += new System.EventHandler(this.test);
                //cc.Click += new System.EventHandler(this.test);
                System.IO.FileInfo file = new System.IO.FileInfo(@"wa2.db");
                if (System.IO.File.Exists(@"wa2.db") && file.Length > 5)
                {
                    cc.setNom(addRealName(chL));
                }
                panel5.Controls.Add(cc);
                //panel5.Controls.Add(cc);
                // panel5.BringToFront();
                liste = null;

                j++;
            }
            panel5.BringToFront();
            panel7.SendToBack();
            //db.closeConnection();
            messageContrl1.label2.Text = chListe.Count().ToString();
        }