/// <summary>
 /// ListBox'daki bir kullanýcýya çift týklandýðýnda yeni bir özel sohbet penceresi açmak için kullanýlýr.
 /// </summary>
 private void lstKullanicilar_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     //Seçilen eleman varsa..
     if (lstKullanicilar.SelectedItems.Count > 0 && lstKullanicilar.SelectedItem != null)
     {
         //Seçilen kullanýcýnýn nick'inin al
         string secilenNick = lstKullanicilar.SelectedItem as string;
         if (nick + "(SÝZ)" != secilenNick)
         {
             if (secilenNick != null)
             {
                 lock (ozelSohbetFormlari)
                 {
                     //Eðer bu kullanýcý ile bir sohbet formu zaten açýksa formu aktif yap,
                     //deðilse yeni bir özel sohbet formu aç ve ozelSohbetFormlari listesine ekle
                     if (ozelSohbetFormlari.ContainsKey(secilenNick))
                     {
                         ozelSohbetFormlari[secilenNick].Activate();
                     }
                     else
                     {
                         frmOzelSohbet sohbetFormu = new frmOzelSohbet(this, secilenNick);
                         ozelSohbetFormlari.Add(secilenNick, sohbetFormu);
                         sohbetFormu.Show();
                     }
                 }
             }
         }
     }
 }
        /// <summary>
        /// kullanicicikis komutunu uygulayan fonksyon
        /// </summary>
        /// <param name="nick"></param>
        private void komut_kullanicicikis(string nick)
        {
            //Eðer kullanýcý 'kullanýcýlar' listesinde varsa listeden sil
            lock (kullanicilar)
            {
                if (kullanicilar.Contains(nick))
                {
                    kullanicilar.Remove(nick);
                }
            }
            //Ekrandaki listeyi güncelle
            kullaniciListesiniGuncelle();
            //Eðer bu kullanýcýyle bir sohbet penceresi açýksa, pencereye bilgi gönder
            frmOzelSohbet sohbetFormu = null;

            lock (ozelSohbetFormlari)
            {
                if (ozelSohbetFormlari.ContainsKey(nick))
                {
                    sohbetFormu = ozelSohbetFormlari[nick];
                }
            }
            if (sohbetFormu != null)
            {
                sohbetFormu.KullaniciCikti();
            }
        }
 /// <summary>
 /// ozelmesaj komutunu uygulayan fonksyon
 /// </summary>
 /// <param name="nick">mesajý gönderen nick</param>
 /// <param name="mesaj">mesaj içeriði</param>
 private void komut_ozelmesaj(string nick, string mesaj)
 {
     if (nick == aktif)
     {
         MessageBox.Show("Bu Siz'siniz", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         frmOzelSohbet sohbetFormu = null;
         //Eþzamanlý eriþimlere karþý koleksiyonu kilitleyelim
         lock (ozelSohbetFormlari)
         {
             if (ozelSohbetFormlari.ContainsKey(nick))
             {
                 sohbetFormu = ozelSohbetFormlari[nick];
             }
         }
         //Bu kiþiyle bir sohbet penceresi açýk deðilse önce sohbet penceresini oluþturup açalým
         if (sohbetFormu == null)
         {
             sohbetFormu = new frmOzelSohbet(this, nick);
             lock (ozelSohbetFormlari)
             {
                 ozelSohbetFormlari.Add(nick, sohbetFormu);
             }
             sohbetFormu.Show();
         }
         //Mesajý bu pencereye yönlendirelim
         sohbetFormu.MesajAl(mesaj);
     }
 }
        /// <summary>
        /// kullanicigiris komutunu uygulayan fonksyon
        /// </summary>
        /// <param name="nick"></param>
        private void komut_kullanicigiris(string nick)
        {
            //Eðer kullanýcý 'kullanýcýlar' listesinde yoksa listeye ekle
            lock (kullanicilar)
            {
                if (!kullanicilar.Contains(nick))
                {
                    kullanicilar.Add(nick);
                }
                kullanicilar.Sort();
            }
            //Ekrandaki listeyi güncelle
            kullaniciListesiniGuncelle();
            //Eðer bu kullanýcýyle bir sohbet penceresi açýksa, pencereye bilgi gönder
            frmOzelSohbet sohbetFormu = null;

            lock (ozelSohbetFormlari)
            {
                if (ozelSohbetFormlari.ContainsKey(nick))
                {
                    sohbetFormu = ozelSohbetFormlari[nick];
                }
            }
            if (sohbetFormu != null)
            {
                sohbetFormu.KullaniciGirdi();
            }
        }
示例#5
0
        /// <summary>
        /// ozelmesaj komutunu uygulayan fonksyon
        /// </summary>
        /// <param name="nick">mesajý gönderen nick</param>
        /// <param name="mesaj">mesaj içeriði</param>
        private void komut_ozelmesaj(string nick, string mesaj)
        {
            //Eðer bu nick'li kullanýcýyla bir sohbet penceresi açýksa o pencereye referans alalým.
            frmOzelSohbet sohbetFormu = null;

            //Eþzamanlý eriþimlere karþý koleksiyonu kilitleyelim
            lock (ozelSohbetFormlari)
            {
                if (ozelSohbetFormlari.ContainsKey(nick))
                {
                    sohbetFormu = ozelSohbetFormlari[nick];
                }
            }
            //Bu kiþiyle bir sohbet penceresi açýk deðilse önce sohbet penceresini oluþturup açalým
            if (sohbetFormu == null)
            {
                sohbetFormu = new frmOzelSohbet(this, nick);
                lock (ozelSohbetFormlari)
                {
                    ozelSohbetFormlari.Add(nick, sohbetFormu);
                }
                sohbetFormu.Show();
            }
            //Mesajý bu pencereye yönlendirelim
            sohbetFormu.MesajAl(mesaj);
        }