// ---------------- методы ----------------

		public InfoStationViewModel (Station station)
		{
			Title = "Станция";
			//Инициализация данных от станции 
			//Создание списка данных и последающая их передача вьюшке
			this.station = station;
			CloseCommand = new RelayCommand (o => {
				var intent = CreateIntent ();
				intent.GoBack ();
			});

			items = new GroupRoot ();
			var section1 = new GroupSection ();
			var section2 = new GroupSection ();

			//ячейка - Страна
			var countryCell = new GroupCell ();
			countryCell.CellStyle = GroupCellStyle.Custom| GroupCellStyle.RowClick;
			countryCell.PrimaryText = "Country";
			countryCell.Tag = CellType_Default;
			countryCell.SecondaryText = station.CountryTitle;
			section1.Add (countryCell);


			//ячейка - Город
			var cityCell = new GroupCell ();
			cityCell.CellStyle = GroupCellStyle.Custom| GroupCellStyle.RowClick;
			cityCell.PrimaryText = "City";
			cityCell.Tag = CellType_Default;
			cityCell.SecondaryText = station.CityTitle;
			section1.Add (cityCell);

			if (!string.IsNullOrEmpty (station.RegionTitle)) {
				//ячейка - Регион
				var regionCell = new GroupCell ();
				regionCell.CellStyle = GroupCellStyle.Custom| GroupCellStyle.RowClick;
				regionCell.PrimaryText = "Region";
				regionCell.Tag = CellType_Default;
				regionCell.SecondaryText = station.RegionTitle;
				section1.Add (regionCell);
			}

			if (!string.IsNullOrEmpty (station.StationTitle)) {
				//ячейка - Описание станции
				var titleCell = new GroupCell ();
				titleCell.CellStyle = GroupCellStyle.Custom| GroupCellStyle.RowClick;
				titleCell.PrimaryText = station.StationTitle;
				titleCell.Tag = CellType_ExtendedText;
				section1.Add (titleCell);
			}

			items.Add (section1);


			//Если есть данные о локации
			if (station.Point != null) {
				//ячейка - локация
				var pointCell = new GroupCell ();
				pointCell.CellStyle = GroupCellStyle.Custom | GroupCellStyle.RowClick;
				pointCell.PrimaryText = "Point";
				pointCell.Tag = CellType_Date;
				pointCell.Data = station;
				pointCell.Command = new RelayCommand (o => {
					OpenMapForPlace();
				});
				section2.Add (pointCell);
				items.Add (section2);
			}
		}
Esempio n. 2
0
		// ---------------- методы ----------------


		public ScheduleViewModel ()
		{
			//Инициализация данных 
			Title = "Расписание";
			dateSchedule = DateTime.Now;
			CloseCommand = new RelayCommand (o => {
				var intent = CreateIntent ();
				intent.GoBack ();
			});
			FromScheduleCommand = new RelayCommand (o => {
				var vc = o as UIViewController;
				if(vc!=null){
					var fromSearchList = FromStations ();
					ShowSearchSearchView("from", vc,fromSearchList);
				}
			});
			ToScheduleCommand = new RelayCommand (o => {
				var vc = o as UIViewController;
				if(vc!=null){
					var toSearchList = ToStations ();
					ShowSearchSearchView("to", vc,toSearchList);
				}
			});

			items = new GroupRoot ();
			section1 = new GroupSection ();

			fromCell = new GroupCell ();
			fromCell.Tag = CellType_FromSchedule;
			fromCell.CellStyle = GroupCellStyle.Custom | GroupCellStyle.RowClick;
			fromCell.SecondaryText="From";

			toCell = new GroupCell ();
			toCell.Tag = CellType_ToSchedule;
			toCell.CellStyle = GroupCellStyle.Custom | GroupCellStyle.RowClick;
			toCell.SecondaryText="To";

			dateCell = new GroupCell ();
			dateCell.Tag = CellType_DateSchedule;
			dateCell.CellStyle = GroupCellStyle.Custom | GroupCellStyle.RowClick;
			dateCell.PrimaryText="Date";
			dateCell.SecondaryText = DateScheduleToString;
			dateCell.Command = new RelayCommand (o => {
				OnShowSelectDateHandler(o);
			});

			switchCell = new GroupCell ();
			switchCell.CellStyle = GroupCellStyle.Custom | GroupCellStyle.RowClick;
			switchCell.PrimaryText = "Отображать все станции";
			switchCell.Tag = CellType_Switch;
			switchCell.Data = true;


			section1.Add (fromCell);
			section1.Add (toCell);
			section1.Add (dateCell);
			section1.Add (switchCell);
			items.Add (section1);
		}
Esempio n. 3
0
 public GroupTableSource(UITableView tableView, GroupRoot dataSource) : this(tableView)
 {
     DataSource = dataSource;
 }