-
Notifications
You must be signed in to change notification settings - Fork 0
/
Device.cs
26 lines (25 loc) · 870 Bytes
/
Device.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using CommunityToolkit.Mvvm.ComponentModel;
using System;
namespace RSPhotoConverter
{
public partial class Device : ObservableObject
{
[ObservableProperty]
string _maker, model;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(CropFactor))]
[NotifyPropertyChangedFor(nameof(FocalLengthIn35mmFilm))]
double _f, _fstop, _sensorWidth, _sensorHeight;
public double CropFactor
{
get
{
double sensor35Diagonal = Math.Sqrt(36 * 36 + 24 * 24);
double sensorDiagonal = Math.Sqrt(SensorWidth * SensorWidth + SensorHeight * SensorHeight);
return sensor35Diagonal / sensorDiagonal;
}
}
public double FocalLengthIn35mmFilm => CropFactor * F;
public override string ToString() => Model;
}
}