Пример #1
0
        /// <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.");
            }
        }
Пример #2
0
        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;
        }
Пример #3
0
        // GET: Entertainment
        public ActionResult Index()
        {
            if (Session["Name"] != null)
            {
                return(View(_entertainmentUtil.GetListEntertainments()));
            }

            return(RedirectToAction("Login", "Home"));
        }
Пример #4
0
 private async void DoBackupAsync()
 {
     await Task.Run(() =>
     {
         // Backup Database
         if (entertainmentUtil.GetListEntertainments() != null)
         {
             entertainmentUtil.BackupDatabase(EnumFileConstant.ENTERTAINMENTCONSTANT, FileConstant.BackUpDb);
             // Backup by zipfile
             ZipBackupFiles.ZipFile(EnumFileConstant.ENTERTAINMENT);
         }
     });
 }
Пример #5
0
        private void TextBox_KeyUp(object sender, KeyEventArgs e)
        {
            bool found  = false;
            var  border = (resultStack.Parent as ScrollViewer).Parent as Border;
            var  data   = entertainmentUtil.GetListEntertainments();

            string query = (sender as TextBox).Text;

            if (query.Length == 0)
            {
                // Clear
                resultStack.Children.Clear();
                border.Visibility = Visibility.Collapsed;
            }
            else
            {
                border.Visibility = Visibility.Visible;
            }

            // Clear the list
            resultStack.Children.Clear();

            // Add the result
            foreach (var entertainment in data)
            {
                if (entertainment.EnterName.ToLower().Contains(query.ToLower()))
                {
                    // The word starts with this... Autocomplete must work
                    AddItem(entertainment.EnterName);
                    found = true;
                }

                var links = HandleRandom.RemoveHttpString(entertainment.Links);
                if (links.ToLower().Contains(query.ToLower()))
                {
                    AddItem(entertainment.Links);
                    found = true;
                }
            }

            if (!found)
            {
                resultStack.Children.Add(new TextBlock()
                {
                    Text = "No results found."
                });
            }
        }