Files
marechai/Marechai.Database/Models/Screen.cs

44 lines
1.4 KiB
C#
Raw Normal View History

2019-06-01 22:13:01 +01:00
using System.Collections.Generic;
2019-06-01 23:48:54 +01:00
using System.ComponentModel;
2019-06-01 22:13:01 +01:00
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
2020-02-10 02:10:18 +00:00
namespace Marechai.Database.Models
2019-06-01 22:13:01 +01:00
{
public class Screen : BaseModel<int>
{
2020-02-10 22:44:18 +00:00
[Range(1, 131072), DisplayName("Width (mm)")]
2019-06-01 22:13:01 +01:00
public double? Width { get; set; }
2020-02-10 22:44:18 +00:00
[Range(1, 131072), DisplayName("Height (mm)")]
2019-06-01 22:13:01 +01:00
public double? Height { get; set; }
2020-02-10 22:44:18 +00:00
[Required, DisplayName("Diagonal (inches)")]
2019-06-01 22:13:01 +01:00
public double Diagonal { get; set; }
2019-06-01 23:55:06 +01:00
[DisplayName("Native resolution")]
2019-06-01 22:13:01 +01:00
public virtual Resolution NativeResolution { get; set; }
2020-02-10 22:44:18 +00:00
[Range(2, 281474976710656), DisplayName("Effective colors")]
2019-06-01 22:13:01 +01:00
public long? EffectiveColors { get; set; }
[Required]
public string Type { get; set; }
[NotMapped]
public long? Colors => EffectiveColors ?? NativeResolution.Colors;
2019-06-01 23:48:54 +01:00
[NotMapped]
public string Size
{
get
{
2020-02-10 22:44:18 +00:00
if(Width != null &&
Height != null)
return$"{Width}x{Height} mm";
2019-06-01 23:48:54 +01:00
2020-02-10 22:44:18 +00:00
return"Unknown";
2019-06-01 23:48:54 +01:00
}
}
2019-06-01 22:13:01 +01:00
public virtual ICollection<ResolutionsByScreen> Resolutions { get; set; }
public virtual ICollection<ScreensByMachine> ScreensByMachines { get; set; }
[Required]
public int NativeResolutionId { get; set; }
2019-06-01 22:13:01 +01:00
}
}