Esempio n. 1
0
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var planItem = value as ExecutionStatisticsPlanItem;

            return(planItem?.LastMemoryUsedBytes == null
                                ? String.Empty
                                : $"{DataSpaceConverter.PrettyPrint(planItem.LastMemoryUsedBytes.Value)} ({planItem.LastExecutionMethod}, {planItem.WorkAreaSizingPolicy})");
        }
Esempio n. 2
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            var allocatedInMemoryBytes = (long?)values[0];
            var storageBytes           = (long?)values[1];
            var nonPopulatedBytes      = (long?)values[2];
            var populationStatus       = (string)values[3];

            if (!allocatedInMemoryBytes.HasValue || !storageBytes.HasValue || !nonPopulatedBytes.HasValue || String.IsNullOrEmpty(populationStatus))
            {
                return(ValueConverterBase.ValueNotAvailable);
            }

            var populatedRatio         = Math.Round(((decimal)storageBytes.Value - nonPopulatedBytes.Value) / storageBytes.Value * 100, 2);
            var isPopulating           = String.Equals(populationStatus, "STARTED");
            var populationStatusLabel  = isPopulating ? " - ongoing" : null;
            var populatedRatioLabel    = populatedRatio < 100 || isPopulating ? $"{populatedRatio} %" : null;
            var populationStatusDetail = populatedRatio == 100 && populationStatusLabel == null
                                ? null
                                : $"({populatedRatioLabel}{populationStatusLabel})";

            return($"{DataSpaceConverter.PrettyPrint(allocatedInMemoryBytes.Value)} {populationStatusDetail}");
        }