void DelayTimer_Tick(object sender, EventArgs e) {
_DelayTimer.Stop();
var t = new Thread(() => {
var clonedCurrentItem = this.CurrentItem.Clone();
var tooltip = clonedCurrentItem.ToolTipText;
if (String.IsNullOrEmpty(tooltip) && Type == 1) {
Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, (ThreadStart)(this.Hide));
return;
}
Contents = Type == 0 ? $"{clonedCurrentItem.DisplayName}\r\n{clonedCurrentItem.ToolTipText}" : clonedCurrentItem.ToolTipText;
RaisePropertyChanged("Contents");
// BE-557: clonedCurrentItem.GetPropertyValue returned VT_EMPTY, edge case included to handle this
var perceivedTypeProperty = clonedCurrentItem.GetPropertyValue(
SystemProperties.PerceivedType,
typeof(PerceivedType));
if (perceivedTypeProperty.VarType != VarEnum.VT_EMPTY
&& ((PerceivedType)perceivedTypeProperty.Value) == PerceivedType.Image && !clonedCurrentItem.IsFolder)
{
var image = clonedCurrentItem.ThumbnailSource(
350,
ShellThumbnailFormatOption.Default,
ShellThumbnailRetrievalOption.Default);
image.Freeze();
this.Image = image;
RaisePropertyChanged("Image");
this.FileNameWidth = this.Image.Width - 110;
RaisePropertyChanged("FileNameWidth");
try
{
var ratingValue = clonedCurrentItem.GetPropertyValue(MediaProperties.Rating, typeof(Double)).Value;
var rating = ratingValue == null ? 0 : Convert.ToDouble(ratingValue) / 20D;
this.Rating = rating;
RaisePropertyChanged("Rating");
this.Dimentions =
((Math.Ceiling(
Convert.ToDouble(clonedCurrentItem.GetPropertyValue(SystemProperties.FileSize, typeof(double)).Value))
/ 1024).ToString("# ### ### ##0") + " KB ("
+ clonedCurrentItem.GetPropertyValue(MediaProperties.Dimensions, typeof(String)).Value.ToString()
+ " px )").Trim();
RaisePropertyChanged("Dimentions");
}
catch (NullReferenceException)
{
}
this.FileName = Path.GetFileName(clonedCurrentItem.ParsingName)?.Trim();
RaisePropertyChanged("FileName");
}
else
{
var image = clonedCurrentItem.ThumbnailSource(
64,
ShellThumbnailFormatOption.Default,
ShellThumbnailRetrievalOption.Default);
image.Freeze();
this.Image = image;
RaisePropertyChanged("Image");
}
Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, (ThreadStart)(() => {
var lvi = new LVITEMINDEX();
lvi.iItem = this.ItemIndex;
lvi.iGroup = this._View.GetGroupIndex(this.ItemIndex);
var bounds = new User32.RECT();
User32.SendMessage(this._View.LVHandle, MSG.LVM_GETITEMINDEXRECT, ref lvi, ref bounds);
var rect = new System.Drawing.Rectangle(bounds.Left, bounds.Top, bounds.Right - bounds.Left, bounds.Bottom - bounds.Top);
var posm = User32.GetCursorPosition();
var mousePos = this._View.PointToClient(posm);
var isInsideItem = rect.Contains(mousePos);
if (isInsideItem)
this.Show();
else
this.Hide();
}));
});
t.SetApartmentState(ApartmentState.STA);
t.Start();
}