コード例 #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
ファイル: WaypointModel.cs プロジェクト: em7/PlgToFp
        /// <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
ファイル: WaypointModel.cs プロジェクト: em7/PlgToFp
        /// <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
ファイル: FlightPlanModel.cs プロジェクト: em7/PlgToFp
        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),
                });
        }