Esempio n. 1
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         UCPagingViewModel viewModel = this.DataContext as UCPagingViewModel;
         if (viewModel != null)
         {
             this.LoadDataEvent(viewModel.GetParam(), EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         LogSystem.Error(ex);
     }
 }
Esempio n. 2
0
 private void cboPageSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         UCPagingViewModel viewModel = this.DataContext as UCPagingViewModel;
         viewModel.PageSize = Convert.ToInt32(this.cboPageSize.SelectedValue);
         CommonParam param = viewModel.GetParam();
         this.LoadDataEvent(viewModel.GetParam(), EventArgs.Empty);
         int rowCount = (param == null ? 0 : (param.Count ?? 0));
         viewModel.TotalCount = rowCount;
         viewModel.RefreshAll();
     }
     catch (Exception ex)
     {
         LogSystem.Error(ex);
     }
 }
Esempio n. 3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var element = (FrameworkElement)sender;
         UCPagingViewModel viewModel = this.DataContext as UCPagingViewModel;
         if (element.Name == btnFirstPage.Name)
         {
             viewModel.FirstPage();
             this.LoadDataEvent(viewModel.GetParam(), EventArgs.Empty);
         }
         else if (element.Name == btnPreviousPage.Name)
         {
             viewModel.PreviousPage();
             this.LoadDataEvent(viewModel.GetParam(), EventArgs.Empty);
         }
         else if (element.Name == btnNextPage.Name)
         {
             viewModel.NextPage();
             this.LoadDataEvent(viewModel.GetParam(), EventArgs.Empty);
         }
         else if (element.Name == btnLastPage.Name)
         {
             viewModel.LastPage();
             this.LoadDataEvent(viewModel.GetParam(), EventArgs.Empty);
         }
         else if (element.Name == btnRefreshPage.Name)
         {
             this.LoadDataEvent(viewModel.GetParam(), EventArgs.Empty);
         }
         var name = this.Parent;
     }
     catch (Exception ex)
     {
         LogSystem.Error(ex);
     }
 }