public async Task LoadDayFromApi(DayOverviewViewModel instance)
        {
            foreach (var item in EntireMonth)
            {
                item.IsSelected = false;
            }

            instance.IsSelected = true;
            _SelectedDay        = instance;
            OnPropertyChanged("SelectedDay");
            //finge que ta carregando as tasks da api
            await Task.Delay(222);

            try
            {
                if (Parent != null)
                {
                    if (Parent is MainWindowViewModel)
                    {
                        var pvm = Parent as MainWindowViewModel;
                        pvm.OnPropertyChanged("HeaderDate");
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }

            IsBusy = false;
        }
 public async Task btnDay_Click(DayOverviewViewModel instance)
 {
     if (!instance.IsSelected && !IsBusy)
     {
         IsBusy = true;
         await LoadDayFromApi(instance);
     }
 }
Ejemplo n.º 3
0
 public async Task btnDay_Click(DayOverviewViewModel dayOverviewViewModel)
 {
     if (!dayOverviewViewModel.IsSelected && !IsBusy)
     {
         IsBusy = true;
         await LoadDayFromApi(dayOverviewViewModel);
     }
 }
Ejemplo n.º 4
0
        public async Task LoadDayFromApi(DayOverviewViewModel dayOverviewViewModel)
        {
            foreach (var day in DayList)
            {
                day.IsSelected = false;
            }

            dayOverviewViewModel.IsSelected = true;

            //finge que ta carregando as tasks da api
            await Task.Delay(222);

            IsBusy = false;
        }
        public void FillEntireMonth(int year, int month)
        {
            var daysInMonth = DateTime.DaysInMonth(year, month);

            EntireMonth = new ObservableCollection <DayOverviewViewModel>();

            for (int i = 1; i <= daysInMonth; i++)
            {
                var item = new DayOverviewViewModel()
                {
                    Date       = new DateTime(year, month, i, 0, 0, 0),
                    IsSelected = false,
                    WorkedTime = new TimeSpan(7, 59, 0)
                };
                EntireMonth.Add(item);
            }
        }