EFB/Models/ChartModel.cs

62 lines
1.9 KiB
C#
Raw Normal View History

2022-02-09 17:59:02 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EFB.Models.JSON;
using Newtonsoft.Json;
2022-02-09 17:59:02 +00:00
namespace EFB.Models
{
public class ChartModel
{
public Chart[] General { get; set; }
public Chart[] TextualData { get; set; }
public Chart[] GroundLayout { get; set; }
public Chart[] SID { get; set; }
public Chart[] STAR { get; set; }
public Chart[] Approach { get; set; }
public Chart[] Transition { get; set; }
public Chart[] PilotBriefing { get; set; }
[JsonConstructor]
public ChartModel(){
//Empty constructor for JSON Serialisation Purposes
}
public ChartModel(ChartList response)
{
General = FillChart(response.General);
TextualData = FillChart(response.TextualData);
GroundLayout = FillChart(response.GroundLayout);
SID = FillChart(response.SID);
STAR = FillChart(response.STAR);
Approach = FillChart(response.Approach);
Transition = FillChart(response.Transition);
PilotBriefing = FillChart(response.PilotBriefing);
}
private Chart[] FillChart(ChartsCollection collection){
if (collection != null)
{
return collection.Charts;
}
return new Chart[]{};
}
2022-02-09 17:59:02 +00:00
}
public class Pinned
{
public Chart[] Charts { get; set; }
}
// public class Chart *Found in Models/JSON*
// {
// public string Name { get; set; }
// public string Identifier { get; set; }
// public int TypeCode { get; set; }
// public string Type { get; set; }
// public string Runway { get; set; }
// public string PseudoURL { get; set; }
// public string URL { get; set; }
// }
2022-02-09 17:59:02 +00:00
}