Пример #1
0
        /// <summary>
        /// Load the textual properties into a list box
        /// </summary>
        private void LoadProperties()
        {
            listViewProperties.Columns.Add("Key");
            listViewProperties.Columns.Add("Value");

            foreach (KeyValuePair <string, string> pair in m_properties)
            {
                ListViewItem item = listViewProperties.Items.Add(pair.Key);
                item.SubItems.Add(pair.Value);
            }

            try
            {
                /* Also add IObjectSafety information if available */
                IObjectSafety objSafety = m_pObject as IObjectSafety;
                if (objSafety != null)
                {
                    uint supportedOptions;
                    uint enabledOptions;
                    Guid iid = COMInterfaceEntry.IID_IDispatch;

                    objSafety.GetInterfaceSafetyOptions(ref iid, out supportedOptions, out enabledOptions);
                    for (int i = 0; i < 4; i++)
                    {
                        int val = 1 << i;
                        if ((val & supportedOptions) != 0)
                        {
                            ListViewItem item = listViewProperties.Items.Add(Enum.GetName(typeof(ObjectSafetyFlags), val));
                        }
                    }
                }
            }
            catch
            {
            }

            ServerInformation info = COMUtilities.GetServerInformation(m_pObject);

            if (info.dwServerPid != 0)
            {
                listViewProperties.Items.Add("Server PID").SubItems.Add(info.dwServerPid.ToString());
                listViewProperties.Items.Add("Server TID").SubItems.Add(info.dwServerTid.ToString());
                listViewProperties.Items.Add("Server Address").SubItems.Add(string.Format("0x{0:X}", info.ui64ServerAddress));
            }
            listViewProperties.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
        }