コード例 #1
0
        public virtual int CompareTo(Column column, IFolderObject obj)
        {
            // get the values for this item and the other item in the
            // specified column

            object value1 = GetColumnValue(column);
            object value2 = obj.GetColumnValue(column);

            if (column != null && column.Comparer != null)
            {
                // the column provides a comparer
                return(column.Comparer.Compare(value1, value2));
            }
            else if (value1 == null && value2 != null)
            {
                return(1);                      // sort empty column values to the bottom
            }
            else if (value2 == null && value1 != null)
            {
                return(-1);                     // sort empty column values to the bottom
            }
            else if (value1 == null && value2 == null ||
                     !(value1 is IComparable && value2 is IComparable))
            {
                // compare the display names as a last resort
                return(GetDisplayName(NameOptions.Normal).CompareTo(obj.GetDisplayName(NameOptions.Normal)));
            }
            else
            {
                // the values implement IComparable, so work with that;
                // hopefully the values are compatible
                return(((IComparable)value1).CompareTo(value2));
            }
        }
コード例 #2
0
        public int GetInfoTip(QITIPF dwFlags, out string ppwszTip)
        {
            string sValues = string.Empty;

            foreach (Column column in _folderObj.Columns)
            {
                sValues += string.Format("{0}: {1}\r\n", column.Name, _folderObj.GetColumnValue(column));
            }
            sValues  = sValues.TrimEnd('\n');
            sValues  = sValues.TrimEnd('\r');
            ppwszTip = sValues;
            return(WinError.S_OK);
        }