Пример #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Drive.Atonline.Rest.Drive Drive = value as Drive.Atonline.Rest.Drive;
            if (Drive == null)
            {
                return(null);
            }
            LinearGradientBrush linearGradient = new LinearGradientBrush();

            linearGradient.StartPoint = new Point(0, 0);
            linearGradient.EndPoint   = new Point(1, 0);

            GradientStop[] gds;
            if (Drive.Usage_Float < 0.75)
            {
                gds = getCompletionGrandientStops();
            }
            else if (Drive.Usage_Float >= 0.75 && Drive.Usage_Float < 1)
            {
                gds = getAlmostGrandientStops();
            }
            else
            {
                gds = getFullGrandientStops();
            }

            linearGradient.GradientStops.Add(gds[0]);
            linearGradient.GradientStops.Add(gds[1]);

            return(linearGradient);
        }
Пример #2
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     Drive.Atonline.Rest.Drive Drive = value as Drive.Atonline.Rest.Drive;
     if (Drive == null)
     {
         return(0f);
     }
     return(Drive.Usage_Float * 100);
 }
Пример #3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Drive.Atonline.Rest.Drive Drive = value as Drive.Atonline.Rest.Drive;

            if (Drive == null)
            {
                return("Wut");
            }
            if (Drive.Plan == "unlimited")
            {
                return(Drive.Root.Size_fmt);
            }


            return($"{Drive.Root.Size_fmt} used on {Drive.Quota_fmt} available");
        }