Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- namespace MultiCalculadora
- {
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class DaysBetweenDates : ContentPage
- {
- public DaysBetweenDates ()
- {
- InitializeComponent ();
- }
- void OnDateSelected(object Sender, DateChangedEventArgs args)
- {
- Calcular();
- }
- void OnSwitchToggled(object Sender, ToggledEventArgs args)
- {
- Calcular();
- }
- void Calcular()
- {
- TimeSpan timeSpan = endDatePicker.Date - startDatePicker.Date + (includeSwitch.IsToggled ? TimeSpan.FromDays(1) : TimeSpan.Zero);
- resultLabel.Text = String.Format("{0} día{1} entre las Fechas", timeSpan.Days, timeSpan.Days == 1 ? "" : "s");
- }
- }
- }
Add Comment
Please, Sign In to add comment