83 lines
2.3 KiB
C#
83 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LSFE.MobApp.Models
|
|
{
|
|
public class ProductMaterial : INotifyPropertyChanged
|
|
{
|
|
private bool _isDownloaded;
|
|
private bool _isDownloading;
|
|
private double _downloadProgress;
|
|
|
|
public Guid ProductTransId { get; set; }
|
|
public int ProductId { get; set; }
|
|
public string? ProductName { get; set; }
|
|
public string? ProductLink { get; set; }
|
|
public string? FileUrl { get; set; }
|
|
public string? FileExtension { get; set; }
|
|
public string IconEmoji => FileExtension?.ToLower() switch
|
|
{
|
|
".pdf" => "📄",
|
|
".ppt" or ".pptx" => "📊",
|
|
".doc" or ".docx" => "📝",
|
|
_ => "📎"
|
|
};
|
|
|
|
public bool IsDownloaded
|
|
{
|
|
get => _isDownloaded;
|
|
set
|
|
{
|
|
_isDownloaded = value;
|
|
OnPropertyChanged();
|
|
OnPropertyChanged(nameof(DownloadButtonText));
|
|
OnPropertyChanged(nameof(CanDownload));
|
|
}
|
|
}
|
|
|
|
public bool IsDownloading
|
|
{
|
|
get => _isDownloading;
|
|
set
|
|
{
|
|
_isDownloading = value;
|
|
OnPropertyChanged();
|
|
OnPropertyChanged(nameof(CanDownload));
|
|
}
|
|
}
|
|
|
|
public double DownloadProgress
|
|
{
|
|
get => _downloadProgress;
|
|
set
|
|
{
|
|
_downloadProgress = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
private bool _isChecked;
|
|
public bool IsChecked
|
|
{
|
|
get => _isChecked;
|
|
set
|
|
{
|
|
_isChecked = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
public string DownloadButtonText => IsDownloaded ? "✓ Downloaded" : "⬇️ Download";
|
|
public bool CanDownload => !IsDownloading && !IsDownloaded;
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|
|
}
|