コード例 #1
0
ファイル: Presenter.cs プロジェクト: duurt/tcx-editor
        private void OnAddPointEvent(object sender, AddPointEventArgs e)
        {
            if (_route == null)
            {
                _errorView.ShowErrorMessage("Please load route first.");
                return;
            }

            var trackPoint = GetTrackPoint(_selectedTimeStamp);

            if (trackPoint == null)
            {
                _errorView.ShowErrorMessage("Please select a point first");
                return;
            }

            TryCatch(() =>
            {
                var result = _commandRunner.Execute(
                    new AddCoursePointInput
                {
                    Route          = _route,
                    NewCoursePoint = new CoursePoint(
                        trackPoint.Lattitude, trackPoint.Longitude)
                    {
                        Name      = e.Name,
                        Notes     = e.Notes,
                        TimeStamp = _selectedTimeStamp,
                        Type      = e.PointType
                    }
                }) as AddCoursePointResponse;
                _route = result.Route;

                _routeView.ShowRoute(result.Route);
                _routeView.ShowEditCoursePointMarker(
                    result.Route.TrackPoints.First(
                        p => p.TimeStamp == _selectedTimeStamp));

                _guiControls.Apply(new GuiState
                {
                    SaveEnabled       = true,
                    AddCoursePoint    = false,
                    DeleteCoursePoint = true,
                    ScrollRoute       = true
                });
            });
        }
コード例 #2
0
ファイル: GuiStub.cs プロジェクト: duurt/tcx-editor
 public void RaiseAddPointEvent(AddPointEventArgs args) => AddPointEvent.Invoke(this, args);