Ejemplo n.º 1
0
        private void UpdatePage()
        {
            int totalPages = DishDao.GetTotalPages(this.ActualWidth, this.ActualHeight);

            viewTotalPages.Text = "/ " + totalPages.ToString();

            // _selecting_page = false avoid updating view in paging_SelectionChanged(sender, e);
            _selecting_page      = false;
            _page                = Paging.UpdatePage(totalPages);
            paging.ItemsSource   = _page;
            paging.SelectedIndex = _current_page - 1;              //update selected page
            paging.Items.Refresh();
            _selecting_page = true;
        }
Ejemplo n.º 2
0
 // prev button handle
 private void previousButton_Click(object sender, RoutedEventArgs e)
 {
     if (_current_page > 1)
     {
         _current_page--;
     }
     else
     {
         _current_page = DishDao.GetTotalPages(this.ActualWidth, this.ActualHeight);
     }
     paging.SelectedIndex = _current_page - 1;              //update selected page
     // update data for view
     //_dishes_list = DishDao.GetAll(this.ActualWidth, this.ActualHeight, _current_page, filter.SelectedIndex, _is_only_fav);
     //dishesView.ItemsSource = _dishes_list;
 }
Ejemplo n.º 3
0
 // Delay time before auto generate items in page
 private void _timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     Dispatcher.Invoke(() =>
     {
         int totalPages = DishDao.GetTotalPages(this.ActualWidth, this.ActualHeight);
         if (_current_page > totalPages)
         {
             _current_page = totalPages;
         }
         else
         {
             //do nothing
         }
         UpdateView();
         UpdatePage();
     });
     _timer.Stop();
 }