Example #1
0
        /// <summary>
        ///   Loops through all the from Stations and adds them to the
        ///     comboBoxPrimary combo box. It only adds one of each station,
        ///     since they are sorted alphabetically it does this by checking
        ///     against the previous value.
        /// </summary>
        private void InitialiseComboBoxPrimary()
        {
            this.stnList = new ObservableCollection <string>();
            this.stnList.Add(string.Empty);

            string previousvalue = string.Empty;
            string location      = string.Empty;

            for (int i = 0; i < journeyController.GetMileageDetailsLength(); i++)
            {
                location = journeyController.GetFromStation(i);
                if (location != previousvalue)
                {
                    this.stnList.Add(location);
                }

                previousvalue = location;
            }
        }
Example #2
0
        /// <summary>
        /// Add a new route to the journey controller and reset all fields.
        /// </summary>
        private void AddNewRoute()
        {
            int nextPairId = (journeyController.GetMileageDetailsLength() / 2) + 1;

            RouteDetailsType newOutRoute =
                new RouteDetailsType(
                    this.NewFromStn,
                    this.NewToStn,
                    this.NewViaRoute,
                    nextPairId.ToString(),
                    new MilesChains(
                        this.NewOutMiles,
                        this.NewOutChains));

            RouteDetailsType newBackRoute =
                new RouteDetailsType(
                    this.NewToStn,
                    this.NewFromStn,
                    this.NewViaReturnRoute,
                    nextPairId.ToString(),
                    new MilesChains(
                        this.NewBackMiles,
                        this.NewBackChains));

            this.journeyController.PutRoute(newOutRoute);
            this.journeyController.PutRoute(newBackRoute);

            this.journeyController.SaveMileageDetails();

            this.InitialiseAddFields();
            this.RaiseAddPropertyChangedEvents();
        }