public StatReportSelectViewModel(StatReportViewModel rootViewModel) { this.rootViewModel = rootViewModel; this.m_command = new RefreshCommand(this.rootViewModel); this.m_Months = new ObservableCollection<MonthSelectViewModelItem>(); this.m_aircrafts = new ObservableCollection<AircraftSelectViewModelItem>(); this.m_Years = new ObservableCollection<YearSelectViewModelItem>(); m_Years.Add(new AllYearSelectViewModelItem()); int year = ServerHelper.GetEarliestYear(ApplicationContext.Instance.CurrentAircraftModel); for (int i = year; i <= DateTime.Now.Year; i++) { m_Years.Add(new YearSelectViewModelItem() { Year = i, Display = string.Format("{0}年", i) }); } this.m_Months.Add(new AllMonthSelectViewModelItem()); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 1, Display = "1月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 2, Display = "2月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 3, Display = "3月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 4, Display = "4月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 5, Display = "5月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 6, Display = "6月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 7, Display = "7月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 8, Display = "8月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 9, Display = "9月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 10, Display = "10月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 11, Display = "11月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 12, Display = "12月" }); this.m_aircrafts.Add(new AllFlightSelectViewModelItem(this)); var aircrafts = ServerHelper.GetAllAircrafts(ApplicationContext.Instance.CurrentAircraftModel); if (aircrafts != null && aircrafts.Count() > 0) { foreach (var air in aircrafts) { this.m_aircrafts.Add(new AircraftSelectViewModelItem(this) { AircraftNumber = air.AircraftNumber }); } } }
public StatReportSelectViewModel(StatReportViewModel rootViewModel) { this.rootViewModel = rootViewModel; this.m_command = new RefreshCommand(this.rootViewModel); this.m_Months = new ObservableCollection<MonthSelectViewModelItem>(); this.m_flight = new ObservableCollection<FlightSelectViewModelItem>(); this.m_Years = new ObservableCollection<YearSelectViewModelItem>(); m_Years.Add(new AllYearSelectViewModelItem()); this.m_Months.Add(new AllMonthSelectViewModelItem()); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 1, Display = "1月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 2, Display = "2月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 3, Display = "3月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 4, Display = "4月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 5, Display = "5月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 6, Display = "6月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 7, Display = "7月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 8, Display = "8月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 9, Display = "9月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 10, Display = "10月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 11, Display = "11月" }); this.m_Months.Add(new MonthSelectViewModelItem() { Month = 12, Display = "12月" }); this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); //this.m_flight.Add(new AllFlightSelectViewModelItem(this)); }
private StatReportViewModel SetDataContext() { StatReportViewModel viewModel = new StatReportViewModel(); if (ApplicationContext.Instance.CurrentFlight == null && viewModel.SelectModel.Aircrafts.Count > 0 && viewModel.SelectModel.Aircrafts[0] is AllFlightSelectViewModelItem) { (viewModel.SelectModel.Aircrafts[0] as AllFlightSelectViewModelItem).IsSelected = true; } viewModel.SelectModel.SelectedYear = viewModel.SelectModel.Years[0]; viewModel.SelectModel.SelectedMonth = viewModel.SelectModel.Months[0]; viewModel.DataModel.PropertyChanged += DataModel_PropertyChanged; return viewModel; }
public RefreshCommand(StatReportViewModel rootViewModel) { this.rootViewModel = rootViewModel; }