public void UpdateEmptyRecycleBin()
        {
            Debug.WriteLine("UpdateEmptyRecycleBin");
            RecycleBinInfo info  = OS.GetAllRecycleBinInfo();
            string         label = "Empty Recycle Bins";

            if (info != null)
            {
                label += " (";
                if (info.ItemCount == 0 && info.Size == 0)
                {
                    label += "Empty";
                }
                else
                {
                    label += $"{info.ItemCount:N0} ";
                    if (info.ItemCount == 1)
                    {
                        label += $"Item";
                    }
                    else
                    {
                        label += $"Items";
                    }
                    label += $", {FormatBytes.Format(info.Size)}";
                }
                label += ")";
            }
            EmptyRecycleBinLabel = label;
            allRecycleBinInfo    = info;
            EmptyRecycleBin.RaiseCanExecuteChanged();
        }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     try {
         return(FormatBytes.Format(System.Convert.ToDouble(value)));
     }
     catch {
         return(null);
     }
 }
示例#3
0
        private void UpdateEmptyRecycleBinThread()
        {
            Debug.WriteLine("UpdateEmptyRecycleBin");
            RecycleBinInfo info  = OS.GetAllRecycleBinInfo();
            string         label = "Empty Recycle Bins";

            if (info != null)
            {
                label += " (";
                if (info.ItemCount == 0 && info.Size == 0)
                {
                    label += "Empty";
                }
                else
                {
                    label += $"{info.ItemCount:N0} ";
                    if (info.ItemCount == 1)
                    {
                        label += $"Item";
                    }
                    else
                    {
                        label += $"Items";
                    }
                    label += $", {FormatBytes.Format(info.Size)}";
                }
                label += ")";
            }
            EmptyRecycleBinLabel = label;
            allRecycleBinInfo    = info;
            EmptyRecycleBin.RaiseCanExecuteChanged();
            if (lastRecycleWatch == null)
            {
                lastRecycleWatch = Stopwatch.StartNew();
            }
            else
            {
                lastRecycleWatch.Restart();
            }
        }