Exemplo n.º 1
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values[0] == DependencyProperty.UnsetValue || values[1] == DependencyProperty.UnsetValue)
            {
                return(null);
            }
            UInt32 p1    = System.Convert.ToUInt32(values[0]);
            UInt32 p2    = System.Convert.ToUInt32(values[1]);
            Int64  bytes = p1 * p2;

            BytesToMegaBytesConverter converter = new BytesToMegaBytesConverter();

            return(converter.Convert(bytes, typeof(String), parameter, culture));
        }
Exemplo n.º 2
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values[0] == DependencyProperty.UnsetValue || values[1] == DependencyProperty.UnsetValue || values[2] == DependencyProperty.UnsetValue)
            {
                return(null);
            }
            UInt32 totalPieces         = System.Convert.ToUInt32(values[0]);
            UInt32 pieceSize           = System.Convert.ToUInt32(values[1]);
            UInt32 numPiecesDownloaded = System.Convert.ToUInt32(values[2]);

            BytesToMegaBytesConverter conv = new BytesToMegaBytesConverter();
            string strPieceSize            = (string)conv.Convert(pieceSize, typeof(string), null, culture);

            return(String.Format("{0} x {1} (have {2})", totalPieces, strPieceSize, numPiecesDownloaded));
        }