public EditWaypointViewModelDesign() : base(null) { WaypointModel = new WaypointModel() { Identifier = "IDENT", Latitude = 6.66, Longitude = 12.89 }; ErrorsContainer.SetErrors(() => Identifier, new[] { new ValidationResult(false, "Identifier error") }); ErrorsContainer.SetErrors(() => Longitude, new []{new ValidationResult(false, "Longitude error")}); ErrorsContainer.SetErrors(() => Latitude, new[] { new ValidationResult(false, "Latitude error") }); }
/// <summary> /// Creates a new waypoint model from the waypoint data object /// </summary> public static WaypointModel FromCoreWaypoint(Core.Waypoint waypoint) { var model = new WaypointModel(); model._waypoint = waypoint; model._latitude = waypoint.Latitude; model._longitude = waypoint.Longitude; model._identifier = waypoint.Identifier; return model; }
/// <summary> /// Creates a new waypoint model from the waypoint data object /// </summary> public static WaypointModel FromCoreWaypoint(Core.Waypoint waypoint) { var model = new WaypointModel(); model._waypoint = waypoint; model._latitude = waypoint.Latitude; model._longitude = waypoint.Longitude; model._identifier = waypoint.Identifier; return(model); }
public static FlightPlanModel FromCoreFlightPlan(Core.FlightPlan flightPlan) { var model = new FlightPlanModel(); model._flightPlan = flightPlan; model._origin = flightPlan.Origin; model._destination = flightPlan.Destination; if (flightPlan.Waipoints != null) { var waypoints = flightPlan.Waipoints.Select(wp => WaypointModel.FromCoreWaypoint(wp)); model._waypoints = new ObservableCollection <WaypointModel>(waypoints); } return(model); }
private void DeleteWaypoint(WaypointModel waypoint) { if (waypoint == null || _parentFlightPlan == null) { _logger.Log(string.Format("{0}:DeleteWaypoint - waypoint or parent flight plan null. Waypoint: {1}; ParentFlightPlan: {2};", this.GetType().FullName, waypoint == null ? "null" : "OK", _parentFlightPlan == null ? "null" : "OK"), Category.Warn, Priority.Medium ); return; } ParentFlightPlan.RemoveWaypoint(waypoint); }
private void HandleEditCmd(WaypointModel waypoint) { _navigationService.EditWaypoint(waypoint); }
private void HandleDeleteCmd(WaypointModel waypoint) { if (waypoint == null) return; var dlgCnt = _container.Resolve<DeleteWaypointDlgContent>(); var dlgVm = dlgCnt.DataContext as DeleteWaypointDlgViewModel; if (dlgVm != null) { dlgVm.Identifier = waypoint.Identifier; dlgVm.DeleteWaypointCallback = () => DeleteWaypoint(waypoint); } _evtAggregator.GetEvent<ShowDialogEvent>() .Publish(new ShowDialogEventPayload() { DialogContent = dlgCnt, Header = string.Format("Delete waypoint '{0}'?", waypoint.Identifier), }); }