From 059b667901837e001d3ef925cb715571436db7af Mon Sep 17 00:00:00 2001 From: Syed Mustafa Ahmed Naqvi Date: Thu, 27 Aug 2026 11:12:30 +0500 Subject: [PATCH] =?UTF-8?q?feat(ui):=20implement=20Device=E2=86=92DB=20tem?= =?UTF-8?q?plate=20sync=20view?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Device→DB template sync UI wired to TemplateSyncService. --- .../DeviceToDbView.xaml | 170 ++++++++++++++++-- .../DeviceToDbView.xaml.cs | 25 ++- 2 files changed, 182 insertions(+), 13 deletions(-) diff --git a/src/HikvisionAttendanceManager.App/DeviceToDbView.xaml b/src/HikvisionAttendanceManager.App/DeviceToDbView.xaml index 52342dd..03cf2eb 100644 --- a/src/HikvisionAttendanceManager.App/DeviceToDbView.xaml +++ b/src/HikvisionAttendanceManager.App/DeviceToDbView.xaml @@ -1,22 +1,168 @@ + + + + + + + + + + - - - - - - - - - + + - - - + + + diff --git a/src/HikvisionAttendanceManager.App/DeviceToDbView.xaml.cs b/src/HikvisionAttendanceManager.App/DeviceToDbView.xaml.cs index b9ea929..f7312f8 100644 --- a/src/HikvisionAttendanceManager.App/DeviceToDbView.xaml.cs +++ b/src/HikvisionAttendanceManager.App/DeviceToDbView.xaml.cs @@ -21,9 +21,32 @@ public partial class DeviceToDbView : UserControl { if (_initialized) return; _initialized = true; - DeviceCombo.ItemsSource = await _devices.LoadUnifiedAsync(); + await RefreshAsync(); } + public async Task RefreshAsync() + { + var originalContent = RefreshButton.Content; + try + { + RefreshButton.IsEnabled = false; + RefreshButton.Content = "Refreshing..."; + DeviceCombo.SelectedItem = null; + DeviceCombo.ItemsSource = await _devices.LoadUnifiedAsync(); + ProgressCard.Visibility = Visibility.Collapsed; + ProgressBar.Value = 0; + ProgressText.Text = ""; + CounterText.Text = ""; + } + finally + { + RefreshButton.IsEnabled = true; + RefreshButton.Content = originalContent; + } + } + + private async void Refresh_Click(object sender, RoutedEventArgs e) => await RefreshAsync(); + private async void StartSync_Click(object sender, RoutedEventArgs e) { if (DeviceCombo.SelectedItem is not Device device) { MessageBox.Show("Select a device."); return; }