/// <summary> /// Calculates the upcomming period from the inputs /// </summary> /// <param name="startDate">The start date from the last period</param> public void ValueChanged(DateTime startDate) { // remove the previous added text PeriodAddText.Visibility = Windows.UI.Xaml.Visibility.Collapsed; DateTime StartDate = startDate; int PeriodDuration = int.Parse(PCal_MainPage.GetDataFromComboBoxItem(Duration.SelectedItem)); int PeriodCycleLength = int.Parse(PCal_MainPage.GetDataFromComboBoxItem(CycleLength.SelectedItem)); NextPeriod.Text = StartDate.AddDays(PeriodCycleLength).ToString("D"); }
public AddView(PCal_MainPage MainPage) { this.InitializeComponent(); this.mainPage = MainPage; // set defaults on the Add Period view Duration.SelectedIndex = DURATION_DEFAULT + DURATION_INDEX; CycleLength.SelectedIndex = CYCLE_LENGTH_DEFAULT + CYCLE_LENGTH_INDEX; // if the most recent period is avail, copy it's details into the new one if (mainPage.mostRecentPeriod != null) { Duration.SelectedIndex = mainPage.mostRecentPeriod.Duration + DURATION_INDEX; CycleLength.SelectedIndex = mainPage.mostRecentPeriod.CycleLength + CYCLE_LENGTH_INDEX; } // initialize the date picker and setup the event handler StartDate.ValueChanged += ValueChanged; }
public EditView(PCal_MainPage MainPage) { this.InitializeComponent(); this.mainPage = MainPage; }