private void ArcGISDynamicMapServiceLayer_Initialized(object sender, EventArgs e)
{
List<int> months = new List<int>();
for (int i = 1; i <= 12; i++)
{
months.Add(i);
}
StartMonthListBox.ItemsSource = months;
EndMonthListBox.ItemsSource = months;
StartMonthListBox.SelectedIndex = 0;
EndMonthListBox.SelectedIndex = 0;
years = new List<int>();
DateTime dt = (sender as ArcGISDynamicMapServiceLayer).TimeExtent.Start;
while (dt < (sender as ArcGISDynamicMapServiceLayer).TimeExtent.End)
{
years.Add(dt.Year);
dt = dt.AddYears(1);
}
StartYearListBox.ItemsSource = years;
EndYearListBox.ItemsSource = years;
StartYearListBox.SelectedIndex = 0;
EndYearListBox.SelectedIndex = 10;
List<int> days = new List<int>(); // set this when a month is selected
for (int i = 1; i <= 31; i++)
{
days.Add(i);
}
StartDayListBox.ItemsSource = days;
EndDayListBox.ItemsSource = days;
StartDayListBox.SelectedIndex = 0;
EndDayListBox.SelectedIndex = 0;
MyMap.TimeExtent = new TimeExtent(startDT, endDT);
}