IconProvider, container exceptions, refactor
This commit is contained in:
21
src/GuiApp/FileTime.Avalonia/Models/ImagePath.cs
Normal file
21
src/GuiApp/FileTime.Avalonia/Models/ImagePath.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
src/GuiApp/FileTime.Avalonia/Models/ImagePathType.cs
Normal file
9
src/GuiApp/FileTime.Avalonia/Models/ImagePathType.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace FileTime.Avalonia.Models
|
||||
{
|
||||
public enum ImagePathType
|
||||
{
|
||||
Asset,
|
||||
Absolute,
|
||||
Raw
|
||||
}
|
||||
}
|
||||
16
src/GuiApp/FileTime.Avalonia/Models/PlaceInfo.cs
Normal file
16
src/GuiApp/FileTime.Avalonia/Models/PlaceInfo.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user