コード例 #1
0
        private static UnitOfIncident GetUnitFromUnitList(
            string unitId,
            List <JObject> unitJsonObjects,
            IncidentTaskState taskStateOfUnit)
        {
            UnitOfIncident ownUnit = null;

            var matchingUnitJson =
                unitJsonObjects.FirstOrDefault(unit => unit.Value <string>(GeobrokerConstants.UnitIdProperty) == unitId);

            if (matchingUnitJson != null)
            {
                ownUnit = new UnitOfIncident(
                    unitId,
                    matchingUnitJson.Value <string>(GeobrokerConstants.UnitNameProperty),
                    CreateGeoPoint(matchingUnitJson[GeobrokerConstants.UnitLastPointProperty]),
                    taskStateOfUnit
                    );
            }
            else
            {
                Console.WriteLine($"Unit with ID {unitId} is not present in list of units!");
            }

            return(ownUnit);
        }
コード例 #2
0
 private static UnitOfIncident CreateUnit1(IncidentTaskState expectedState)
 {
     return(new UnitOfIncident("unit-id-1",
                               "Own Unit",
                               new GeoPoint(48.5, 16.5),
                               expectedState
                               ));
 }
コード例 #3
0
 public UnitOfIncident(
     string id,
     string name,
     GeoPoint lastPoint      = null,
     IncidentTaskState state = IncidentTaskState.Unknown)
 {
     Id        = id;
     Name      = name;
     LastPoint = lastPoint;
     State     = state;
 }