From d7bbfca952d96b01bd7ada522a58d5a2768d89a4 Mon Sep 17 00:00:00 2001 From: "kwan.nguyen" Date: Fri, 6 Dec 2024 00:12:55 +0700 Subject: [PATCH] update keep search text on data center page --- PCUT/PCUT/Pages/DataCenterPage.xaml.cs | 7 +++++-- PCUT/PCUT/ViewModels/FileListViewModel.cs | 5 ----- PCUT/PCUT/ViewModels/MainMenuPageViewModel.cs | 12 ++---------- PCUT/PCUT/ViewModels/PaginationViewModel.cs | 9 +++++++++ 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/PCUT/PCUT/Pages/DataCenterPage.xaml.cs b/PCUT/PCUT/Pages/DataCenterPage.xaml.cs index ce64c50..3933aae 100644 --- a/PCUT/PCUT/Pages/DataCenterPage.xaml.cs +++ b/PCUT/PCUT/Pages/DataCenterPage.xaml.cs @@ -1,12 +1,10 @@ using Http.Core.Contexts; using Newtonsoft.Json; using PCUT.ViewModels; -using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using Windows.Storage; -using Windows.UI.Popups; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; @@ -40,6 +38,11 @@ namespace PCUT.Pages { var mainMenuPageViewModel = e.Parameter as MainMenuPageViewModel; ViewModels.Categories = mainMenuPageViewModel.Categories; + ViewModels.Pagination.InitSearchText(mainMenuPageViewModel.DataCenterSearchValue); + ViewModels.Pagination.TextSearched += (sender, args) => + { + mainMenuPageViewModel.DataCenterSearchValue = args.Text; + }; base.OnNavigatedTo(e); } diff --git a/PCUT/PCUT/ViewModels/FileListViewModel.cs b/PCUT/PCUT/ViewModels/FileListViewModel.cs index 4ea3a7e..eca180f 100644 --- a/PCUT/PCUT/ViewModels/FileListViewModel.cs +++ b/PCUT/PCUT/ViewModels/FileListViewModel.cs @@ -1,23 +1,18 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; -using Windows.Storage; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media.Imaging; -using Newtonsoft.Json; using PCUT.Entities; using PCUT.Entities.ApiResponse; using PCUT.Extensions; using PCUT.Models; using Http.Core; -using Http.Core.Contexts; using Http.Core.Extensions; using static Http.Core.Constants.HttpConstants; -using System.ComponentModel; using Windows.ApplicationModel.Core; using Http.Core.Exceptions; diff --git a/PCUT/PCUT/ViewModels/MainMenuPageViewModel.cs b/PCUT/PCUT/ViewModels/MainMenuPageViewModel.cs index 873a685..e5c3d4b 100644 --- a/PCUT/PCUT/ViewModels/MainMenuPageViewModel.cs +++ b/PCUT/PCUT/ViewModels/MainMenuPageViewModel.cs @@ -2,20 +2,10 @@ using PCUT.Entities; using PCUT.Models; using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; using System.Threading.Tasks; -using Http.Core; using Http.Core.Extensions; using static Http.Core.Constants.HttpConstants; -using Newtonsoft.Json; -using Windows.UI.Popups; using Http.Core.Contexts; -using System.Collections.ObjectModel; -using Windows.UI.Xaml.Controls; using Windows.UI.Xaml; namespace PCUT.ViewModels @@ -99,5 +89,7 @@ namespace PCUT.ViewModels Categories.Load(categories); } } + + public string DataCenterSearchValue { get; set; } } } diff --git a/PCUT/PCUT/ViewModels/PaginationViewModel.cs b/PCUT/PCUT/ViewModels/PaginationViewModel.cs index 389fd44..0e00226 100644 --- a/PCUT/PCUT/ViewModels/PaginationViewModel.cs +++ b/PCUT/PCUT/ViewModels/PaginationViewModel.cs @@ -56,6 +56,15 @@ namespace PCUT.ViewModels } } + public void InitSearchText(string text) + { + if (_searchText != text) + { + _searchText = text; + RaisePropertyChanged(nameof(SearchText)); + } + } + private int _page = 0; public int Page {