IconProvider, container exceptions, refactor

This commit is contained in:
2022-02-02 11:02:37 +01:00
parent c4bf417ba3
commit 3e553dd448
31 changed files with 597 additions and 132 deletions

View File

@@ -0,0 +1,21 @@
namespace FileTime.Avalonia.Models
{
public class ImagePath
{
public string? Path { get; }
public ImagePathType Type { get; }
public object? Image { get; }
public ImagePath(ImagePathType type, string path)
{
Path = path;
Type = type;
}
public ImagePath(ImagePathType type, object image)
{
Image = image;
Type = type;
}
}
}

View File

@@ -0,0 +1,9 @@
namespace FileTime.Avalonia.Models
{
public enum ImagePathType
{
Asset,
Absolute,
Raw
}
}

View File

@@ -0,0 +1,16 @@
using FileTime.Core.Models;
namespace FileTime.Avalonia.Models
{
public class PlaceInfo
{
public string Name { get; }
public IContainer Container { get; }
public PlaceInfo(string name, IContainer container)
{
Name = name;
Container = container;
}
}
}

View File

@@ -19,6 +19,9 @@ namespace FileTime.Avalonia.Models
[Property]
private string _fullName;
[Property]
private string _label;
[Property]
private long _size;
@@ -37,11 +40,17 @@ namespace FileTime.Avalonia.Models
_driveInfo = driveInfo;
_container = container;
Name = container.Name;
FullName = container.FullName;
Size = driveInfo.TotalSize;
Free = driveInfo.AvailableFreeSpace;
Used = driveInfo.TotalSize - driveInfo.AvailableFreeSpace;
Refresh();
}
private void Refresh()
{
Name = _container.Name;
FullName = _container.FullName;
Label = _driveInfo.VolumeLabel;
Size = _driveInfo.TotalSize;
Free = _driveInfo.AvailableFreeSpace;
Used = _driveInfo.TotalSize - _driveInfo.AvailableFreeSpace;
}
}
}