public static string GetDeviceProperties(IRTCPresenceDevice device)
        {
            Trace.WriteLine("Entering RTCHelp.GetDeviceProperties");

            StringBuilder properties = new StringBuilder();
            string displayname;
            RTC_PRESENCE_STATUS presenceStatus;
            string notes;
            string space;
            string data;

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

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

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

            try
            {
                device.GetPresenceData(out space, out data);
            }
            catch  (COMException)
            {
                space = "NOT EXIST";
                data = "NOT EXIST";
            }

            properties.Append(string.Format("Device Name: {0}\n",
                    displayname));
            properties.Append(string.Format("    Status: {0}\n",
                presenceStatus));
            properties.Append(string.Format("    Notes: {0}\n",
                notes));
            properties.Append(string.Format("    NameSpace: {0}\n",
                space));
            properties.Append(string.Format("    Data: {0}\n",
                data));

            //Note: one dummy device object was provided for offline buddies
            if (displayname == "NOT EXIST")
            {
                return null;
            }

            return properties.ToString();
        }
예제 #2
0
        public static string GetDeviceProperties(IRTCPresenceDevice device)
        {
            Trace.WriteLine("Entering RTCHelp.GetDeviceProperties");

            StringBuilder       properties = new StringBuilder();
            string              displayname;
            RTC_PRESENCE_STATUS presenceStatus;
            string              notes;
            string              space;
            string              data;

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

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

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

            try
            {
                device.GetPresenceData(out space, out data);
            }
            catch (COMException)
            {
                space = "NOT EXIST";
                data  = "NOT EXIST";
            }

            properties.Append(string.Format("Device Name: {0}\n",
                                            displayname));
            properties.Append(string.Format("    Status: {0}\n",
                                            presenceStatus));
            properties.Append(string.Format("    Notes: {0}\n",
                                            notes));
            properties.Append(string.Format("    NameSpace: {0}\n",
                                            space));
            properties.Append(string.Format("    Data: {0}\n",
                                            data));

            //Note: one dummy device object was provided for offline buddies
            if (displayname == "NOT EXIST")
            {
                return(null);
            }

            return(properties.ToString());
        }