예제 #1
0
 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") });
 }
예제 #2
0
        /// <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;
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
 private void HandleEditCmd(WaypointModel waypoint)
 {
     _navigationService.EditWaypoint(waypoint);
 }
예제 #7
0
        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),
                });
        }