/// <summary> /// Load data to list view /// </summary> public void ReloadData() { // show list book if (entertainmentUtil.GetListEntertainments() != null) { // Count objects ListObjectEt.Foreground = Brushes.ForestGreen; ListObjectEt.Content = entertainmentUtil.GetListEntertainment(30, GetAllRecordEntertainments).Count; var stopwatch = new Stopwatch(); stopwatch.Restart(); // Reload all listviewEt.ItemsSource = entertainmentUtil.GetfirstEntertainment(30); // Refresh list view ICollectionView view = CollectionViewSource.GetDefaultView(listviewEt.ItemsSource); view.Refresh(); // Count objects ListObjectEt.Foreground = Brushes.ForestGreen; ListObjectEt.Content = entertainmentUtil.GetListEntertainment(30, GetAllRecordEntertainments).Count; // count seconds Show_ms.Content = stopwatch.Elapsed.TotalMilliseconds; stopwatch.Stop(); } else { Logs.Warn($"[WPFBigRemGUI.ListEntertainment] There's no element in Db Entertainment."); } }
public ListEntertainment() { LoggerUtil.HandleLogPath(); Logs.Info($"[WPFBigRemGUI.ListEntertainment] Starting ListEntertainment wpf GUI."); InitializeComponent(); entertainmentUtil = new EntertainmentUtil(); // list total GetAllRecordEntertainments = entertainmentUtil.GetListEntertainments(); WindowStartupLocation = WindowStartupLocation.CenterScreen; lblListEt.Foreground = Brushes.Green; var LiveTime = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; LiveTime.Tick += Timer_Tick; LiveTime.Start(); // Disable resize ResizeMode = ResizeMode.CanMinimize; listviewEt.ItemsSource = entertainmentUtil.GetfirstEntertainment(30); ListObjectEt.Content = entertainmentUtil.GetListEntertainment(30, GetAllRecordEntertainments).Count; }