示例#1
0
        public static ArrayList BuildDeviceDisplayNameList(IRTCBuddy2 buddy2)
        {
            Trace.WriteLine("Entering RTCHelp.BuildDeviceDisplayNameList");

            ArrayList           deviceList = new ArrayList();
            string              deviceName;
            RTC_PRESENCE_STATUS deviceStatus;

            try
            {
                IRTCCollection deviceCollection = buddy2.PresenceDevices;

                foreach (IRTCPresenceDevice device in deviceCollection)
                {
                    try
                    {
                        deviceName = device.get_PresenceProperty(RTC_PRESENCE_PROPERTY.RTCPP_DEVICE_NAME);
                    }
                    catch (COMException)
                    {
                        deviceName = "NOT EXIST";
                        Trace.WriteLine("NULL Device Name");
                        continue;
                    }

                    try
                    {
                        deviceStatus = device.Status;
                    }
                    catch (COMException)
                    {
                        deviceStatus = RTC_PRESENCE_STATUS.RTCXS_PRESENCE_OFFLINE;
                    }

                    string deviceDisplayName = RTCHelp.BuildDisplayName(deviceName, deviceStatus);
                    deviceList.Add(deviceDisplayName);
                }
            }
            catch (COMException)
            {
                return(null);
            }

            return(deviceList);
        }
示例#2
0
        private void SessionStateChangeEvent(IRTCSessionStateChangeEvent sessionEvent)
        {
            RTC_SESSION_STATE oturumDurumu        = sessionEvent.State;
            IRTCCollection    oturumKatilimcilari = sessionEvent.Session.Participants;

            string ad  = String.Empty;
            string uri = String.Empty;

            // Uzaktan oturum açýlýnca oturumu baþlatmak için kiþinin(katýlýmcý) bilgilerini elde ediyoruz...
            foreach (IRTCParticipant p in oturumKatilimcilari)
            {
                if (p.UserURI != null)
                {
                    ad  = p.Name;
                    uri = p.UserURI;
                }
            }

            switch (oturumDurumu)
            {
            case RTC_SESSION_STATE.RTCSS_IDLE:     // oturum varsayýlan olarak idle olarak baþlar...
                Trace.WriteLine("Idle");
                break;

            case RTC_SESSION_STATE.RTCSS_HOLD:     // oturum varsayýlan olarak idle olarak baþlar...
                Trace.WriteLine("Hold");
                break;

            case RTC_SESSION_STATE.RTCSS_REFER:     // oturum varsayýlan olarak idle olarak baþlar...
                Trace.WriteLine("Refer");
                break;

            case RTC_SESSION_STATE.RTCSS_INCOMING:     // Uzaktan media oturumu isteði geliyor...
                Trace.WriteLine("incoming");

                // Media oturum isteði geldi
                if ((sessionEvent.Session.Type == RTC_SESSION_TYPE.RTCST_PC_TO_PC))
                {
                    try
                    {
                        MediaOturumuIstegi(sessionEvent.Session, uri, ad);
                    }
                    catch (COMException hata)
                    {
                        this.anaPencere.MesajGoster(hata.ToString(), "Hata");
                    }
                }

                /* IM oturumu MessagingEvent de baþlatýlýyor */

                break;

            case RTC_SESSION_STATE.RTCSS_ANSWERING:
                Trace.WriteLine("answer");
                break;

            case RTC_SESSION_STATE.RTCSS_INPROGRESS:
                Trace.WriteLine("progress");
                break;

            case RTC_SESSION_STATE.RTCSS_CONNECTED:
                Trace.WriteLine("connected");

                if ((sessionEvent.Session.Type == RTC_SESSION_TYPE.RTCST_MULTIPARTY_IM || sessionEvent.Session.Type == RTC_SESSION_TYPE.RTCST_PC_TO_PC))
                {
                    try
                    {
                        Oturumlar.Add(sessionEvent.Session);
                        if ((sessionEvent.Session.Type == RTC_SESSION_TYPE.RTCST_PC_TO_PC))     // media oturumu için uyarý göster
                        {
                            ((frmGorusme)htPencereler[mediaKatilimci]).UyariGoster(Sabitler.VIDEOSES_BASLADI);
                        }
                    }
                    catch (Exception hata)
                    {
                        Trace.WriteLine(hata.ToString());
                    }
                }

                break;

            case RTC_SESSION_STATE.RTCSS_DISCONNECTED:
                Trace.WriteLine("disconnected");

                // oturum nesnesini serbest býrak ki mesaj gönderildiðinde yeniden oturum yaratýlsýn ve pencere oluþturulsun
                if ((sessionEvent.Session.Type == RTC_SESSION_TYPE.RTCST_MULTIPARTY_IM))
                {
                    if (Oturumlar.Contains(sessionEvent.Session))     // Ýki taraftan biri oturumu bitirdi.
                    {
                        Oturumlar.Remove(sessionEvent.Session);
                    }
                    else     // offline kullancýya mesaj gönderiliyor...
                    {
                        ((frmGorusme)htPencereler[IMKatilimci]).UyariGoster(Sabitler.IM_GONDERILEMEDI);
                    }
                }

                if ((sessionEvent.Session.Type == RTC_SESSION_TYPE.RTCST_PC_TO_PC))
                {
                    if (Oturumlar.Contains(sessionEvent.Session))     // Ýki taraftan biri oturumu bitirdi.
                    {
                        Oturumlar.Remove(sessionEvent.Session);
                        ((frmGorusme)htPencereler[mediaKatilimci]).UyariGoster(Sabitler.VIDEOSES_SONLANDIRILDI);
                    }
                    else     // offline kullanýcýya video görüþmesi gönderiliyor veya kullanýcý görüþmeyi reddetti...
                    {
                        ((frmGorusme)htPencereler[mediaKatilimci]).UyariGoster(Sabitler.VIDEOSES_BASLAYAMADI);
                        ((frmGorusme)htPencereler[mediaKatilimci]).MediaGorusmesiAyarla();
                    }
                }

                /* Media oturumu MediaEvent de sonlandýrýlýyor... */
                break;
            }
        }
示例#3
0
        public static string GetBuddyProperties(IRTCBuddy2 buddy2)
        {
            Trace.WriteLine("Entering RTCHelp.GetBuddyProperties");

            StringBuilder       properties = new StringBuilder();
            string              displayname, phone, email;
            string              uri, notes, data;
            bool                fPersistant;
            RTC_PRESENCE_STATUS presenceStatus;

            try
            {
                displayname = buddy2.get_PresenceProperty(RTC_PRESENCE_PROPERTY.RTCPP_DISPLAYNAME);
            }
            catch (COMException)
            {
                displayname = "NOT EXIST";
            }

            try
            {
                phone = buddy2.get_PresenceProperty(RTC_PRESENCE_PROPERTY.RTCPP_PHONENUMBER);
            }
            catch (COMException)
            {
                phone = "NOT EXIST";
            }

            try
            {
                email = buddy2.get_PresenceProperty(RTC_PRESENCE_PROPERTY.RTCPP_EMAIL);
            }
            catch (COMException)
            {
                email = "NOT EXIST";
            }

            try
            {
                uri = buddy2.PresentityURI;
            }
            catch (COMException)
            {
                uri = "NOT EXIST";
            }

            try
            {
                fPersistant = buddy2.Persistent;
            }
            catch (COMException)
            {
                fPersistant = false;
            }

            try
            {
                presenceStatus = buddy2.Status;
            }
            catch (COMException)
            {
                presenceStatus = RTC_PRESENCE_STATUS.RTCXS_PRESENCE_OFFLINE;
            }

            try
            {
                notes = buddy2.Notes;
            }
            catch (COMException)
            {
                notes = "NOT EXIST";
            }

            try
            {
                data = buddy2.Data;
            }
            catch (COMException)
            {
                data = "NOT EXIST";
            }

            properties.Append(string.Format("Buddy Name: {0}\nPhone: {1}\nEmail: {2}\n",
                                            displayname,
                                            phone,
                                            email));

            properties.Append(string.Format("URI: {0}\nStatus: {1}\nPersistant: {2}\nNotes: {3}\nData: {4}\n",
                                            uri,
                                            presenceStatus,
                                            fPersistant,
                                            notes,
                                            data));

            Trace.WriteLine("Get groups");

            properties.Append("Group List: ");

            try
            {
                IRTCCollection groupCollection = buddy2.Groups;

                foreach (IRTCBuddyGroup pGroup in groupCollection)
                {
                    try
                    {
                        if (pGroup.Name == null || pGroup.Name.Length == 0)
                        {
                            Trace.WriteLine("NULL Group Name");
                            continue;
                        }
                        properties.Append(pGroup.Name + "  ");
                    }
                    catch (COMException ex1COM)
                    {
                        Trace.WriteLine("COMException " + ex1COM.Message);
                    }
                }
            }
            catch (COMException ex1COM)
            {
                Trace.WriteLine("COMException " + ex1COM.Message);
            }

            properties.Append("\n");

            Trace.WriteLine("Get devices");

            try
            {
                IRTCCollection deviceCollection = buddy2.PresenceDevices;

                foreach (IRTCPresenceDevice device in deviceCollection)
                {
                    properties.Append(GetDeviceProperties(device));
                }
            }
            catch (COMException ex1COM)
            {
                Trace.WriteLine("COMException " + ex1COM.Message);
            }

            return(properties.ToString());
        }