Guest User

Untitled

a guest
Jan 23rd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. using Xamarin.Forms;
  8. using Xamarin.Forms.Xaml;
  9.  
  10.  
  11. namespace MultiCalculadora
  12. {
  13. [XamlCompilation(XamlCompilationOptions.Compile)]
  14. public partial class DaysBetweenDates : ContentPage
  15. {
  16. public DaysBetweenDates ()
  17. {
  18. InitializeComponent ();
  19. }
  20.  
  21. void OnDateSelected(object Sender, DateChangedEventArgs args)
  22. {
  23. Calcular();
  24. }
  25.  
  26. void OnSwitchToggled(object Sender, ToggledEventArgs args)
  27. {
  28. Calcular();
  29. }
  30.  
  31. void Calcular()
  32. {
  33. TimeSpan timeSpan = endDatePicker.Date - startDatePicker.Date + (includeSwitch.IsToggled ? TimeSpan.FromDays(1) : TimeSpan.Zero);
  34. resultLabel.Text = String.Format("{0} día{1} entre las Fechas", timeSpan.Days, timeSpan.Days == 1 ? "" : "s");
  35. }
  36. }
  37. }
Add Comment
Please, Sign In to add comment