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();
        }
Esempio n. 2
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();
            }
        }