private string GetBridgeName(BridgeLoggerItem member)
        {
            object[] attributes = member.Method.DeclaringType.GetCustomAttributes(typeof(Bridge), false);
            bool found = false;
            string name = "";

            if(attributes.Length > 0) {
                for(int j = 0; j < attributes.Length; j++) {
                    if(attributes[j] is Bridge) {
                        name = ((Bridge)attributes[j]).Name;
                        found = true;
                        break;
                    }
                }
            }

            // attribute not found
            if(found == false) {
                name = member.Method.DeclaringType.Name;
            }

            return name;
        }
        private void ShowDetails(BridgeLoggerItem member)
        {
            ObjectLabel.Text = "Object: " + GetBridgeName(member);
            MemberLabel.Text = "Member: " + GetMemberName(member);
            string type;

            if(member.Method.Name.StartsWith("get_")) {
                type = "Property (get)";
            }
            else if(member.Method.Name.StartsWith("set_")) {
                type = "Property (set)";
            }
            else {
                type = "Method";
            }

            TypeLabel.Text = "Type: " + type;
            ParameterList.Items.Clear();

            for(int i = 0; i < member.Parameters.Count; i++) {
                ListViewItem item = new ListViewItem();

                if(member.Parameters[i].Info == null) {
                    item.Text = "value";
                }
                else {
                    item.Text = member.Parameters[i].Info.Name;
                }
                item.Tag = member.Parameters[i];

                if(member.Parameters[i].Value != null) {
                    item.SubItems.Add(member.Parameters[i].Value.ToString());
                    item.ImageIndex = 2;
                }

                ParameterList.Items.Add(item);
            }

            PropertyList.Items.Clear();

            if(ParameterList.Items.Count > 0) {
                ParameterList.Items[0].Selected = true;
            }
        }
        private string GetMemberName(BridgeLoggerItem member)
        {
            string name = member.Method.Name;

            if(IsProperty(member)) {
                name = name.Substring(4);
            }

            return name;
        }
 private bool IsProperty(BridgeLoggerItem member)
 {
     return member.Method.Name.StartsWith("get_") ||
            member.Method.Name.StartsWith("set_");
 }
        /// <summary>
        /// Log a member call.
        /// </summary>
        /// <param name="parameters">The parameters the member received.</param>
        /// <remarks>The parameters need to be passed to this method in exactly the same order they appear in the member definition.</remarks>
        public void LogMethodCall(params object[] parameters)
        {
            BridgeLoggerItem item = new BridgeLoggerItem();
            item.Time = DateTime.Now;

            // get method info from stack
            StackTrace stackInfo = new StackTrace();
            StackFrame topFrame = stackInfo.GetFrame(1);

            MethodBase method = topFrame.GetMethod();
            item.Method = method;

            // add the parameters
            ParameterInfo[] paramInfo = method.GetParameters();
            item.Parameters = new List<MethodParameterInfo>();

            if(method.Name.StartsWith("set_")) {
                if(parameters.Length > 0) {
                    MethodParameterInfo param = new MethodParameterInfo();
                    param.Value = parameters[0];
                }
            }
            else {
                for(int i = 0; i < paramInfo.Length; i++) {
                    MethodParameterInfo param = new MethodParameterInfo();
                    param.Info = paramInfo[i];

                    if(parameters.Length > i) {
                        param.Value = parameters[i];
                    }

                    item.Parameters.Add(param);
                }
            }

            // add to the list
            _items.Add(item);
        }