Пример #1
0
        public PopularStnConfigViewModel()
        {
            this.StnCollection        = new ObservableCollection <string>();
            this.PopularStnCollection = new ObservableCollection <string>();

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

            JourneyIOController journeyController = JourneyIOController.GetInstance();

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

                previousvalue = location;
            }

            PopularStnIOController locationController = PopularStnIOController.GetInstance();

            //ObservableCollection<string>           locationList       = new List<string>();
            //locationList = locationController.LoadFile();

            foreach (string popular in locationController.LoadFile())
            {
                this.PopularStnCollection.Add(popular);
            }

            this.AddCmd      = new CommonCommand(this.AddStn, this.CanAddStn);
            this.DeleteCmd   = new CommonCommand(this.DeleteStn, this.CanDeleteStn);
            this.CompleteCmd = new CommonCommand <ICloseable>(this.SelectComplete, this.CanSelectComplete);
        }
Пример #2
0
        /// <summary>
        /// Gets the collection of locations without the filter applied.
        /// </summary>
        /// <returns></returns>
        private ObservableCollection <string> GetStnAllCollection()
        {
            ObservableCollection <string> stnCollection = new ObservableCollection <string>();

            string previousvalue   = string.Empty;
            string str             = string.Empty;
            JourneyIOController jc = JourneyIOController.GetInstance();

            for (int i = 0; i < jc.GetMileageDetailsLength(); i++)
            {
                str = jc.GetFromStation(i);
                if (str != previousvalue)
                {
                    stnCollection.Add(str);
                }

                previousvalue = str;
            }

            return(stnCollection);
        }