public void RefreshReferenceLabel() { if (this.Reference != null) { if (this.Property == FileProperty.ContainsTag) { this.ReferenceLabel = LibraryOwner.GetCurrent() .Tags.GetTagValue((int)this.Reference)?.Name; } else if (this.Property.IsDate()) { if (this.Property == FileProperty.DateTimeCreated || this.Property == FileProperty.DateTimeModified || this.Property == FileProperty.DateTimeRegistered) { this.ReferenceLabel = ((DateTimeOffset)this.Reference).ToString("G"); } else { this.ReferenceLabel = ((DateTimeOffset)this.Reference).ToString("d"); } } else if (this.Property == FileProperty.Size) { this.ReferenceLabel = FileSizeConverter.ConvertAuto((long)this.Reference); } else { this.ReferenceLabel = this.Reference.ToString(); } } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var num = MathExtensions.ToLong(value); if (num == null) { return(null); } return(FileSizeConverter.ConvertAuto(num.Value)); }