Exemple #1
0
    public PlanetModel(JSONPlanetModel model)
    {
        rName.Value     = model.Name;
        rRadius.Value   = model.Radius;
        rDistance.Value = model.Distance;

        for (int i = 0; i < model.Atoms.Count; i++)
        {
            Atoms.Add(new AtomModel(model.Atoms[i]));
        }
    }
Exemple #2
0
    public JSONPlanetModel toJSON()
    {
        JSONPlanetModel model = new JSONPlanetModel();

        model.Name     = rName.Value;
        model.Radius   = rRadius.Value;
        model.Distance = rDistance.Value;

        model.Atoms = new List <JSONAtomModel>();
        for (int i = 0; i < Atoms.Count; i++)
        {
            model.Atoms.Add(Atoms[i].toJSON());
        }

        return(model);
    }