示例#1
0
        private void contextMenuStrip1_Opened(object sender, EventArgs e)
        {
            var cached = GetFsItemsArray();

            if (cached.Length == 0)
            {
                contextMenuStrip1.Enabled = false;
                return;
            }

            contextMenuStrip1.Enabled = true;
            var builder = new StringBuilder(_scanner.CurrentTarget);

            for (int i = cached.Length - 1; i >= 0; i--)
            {
                builder.Append(Path.DirectorySeparatorChar);
                builder.Append(cached[i].Name);
            }
            contextMenuStrip1.Tag = builder.ToString();
            builder.AppendFormat("{0}{1}; {2}{0}(hover this tooltip to return back to search mode)",
                                 Environment.NewLine,
                                 cached[0].IsDir ? "Folder" : "File",
                                 Humanize.FsItem(cached[0]));
            toolTip1.Show(builder.ToString(),
                          chart1,
                          chart1.PointToClient(new Point(contextMenuStrip1.Left, contextMenuStrip1.Top - LogicalToDeviceUnits(52 + (int)Math.Ceiling(DeviceDpi / 96.0)))));
        }
示例#2
0
        private void BuildToolTipText()
        {
            var fsItems = GetFsItemsArray();
            var list    = new List <string>();
            var builder = new StringBuilder();

            for (int j = 0; j < fsItems.Length; j++)
            {
                for (int i = j; i < fsItems.Length - 1; i++)
                {
                    builder.Append(">");
                }
                var fsItem = fsItems[j];
                builder.AppendFormat("{0}: {1}", fsItem.Name, Humanize.FsItem(fsItem));
                list.Add(builder.ToString());
                builder.Clear();
            }
            _lastTip = string.Join("\r\n", list);
        }
示例#3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var source = (FsItem)value;

            return(Humanize.FsItem(source));
        }