From d70282e059ef9a26698f80f61626ab104f3ccb56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BD=AD=E7=9C=9F=E6=B6=9B?=
<16362733+peng-zhentao@user.noreply.gitee.com>
Date: Fri, 28 Aug 2026 16:26:55 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5banner=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
AIK.Views/MenuPages/Home/HomePage.xaml | 12 ++++++++----
ViewModels/HomePage/HomePageViewModel.cs | 16 ++++++++++++++--
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/AIK.Views/MenuPages/Home/HomePage.xaml b/AIK.Views/MenuPages/Home/HomePage.xaml
index 28466c0..486287c 100644
--- a/AIK.Views/MenuPages/Home/HomePage.xaml
+++ b/AIK.Views/MenuPages/Home/HomePage.xaml
@@ -68,18 +68,22 @@
diff --git a/ViewModels/HomePage/HomePageViewModel.cs b/ViewModels/HomePage/HomePageViewModel.cs
index d002113..44ccf56 100644
--- a/ViewModels/HomePage/HomePageViewModel.cs
+++ b/ViewModels/HomePage/HomePageViewModel.cs
@@ -143,6 +143,10 @@ namespace AIK.ViewModels.HomePage
Debug.WriteLine($"Loaded: {(loaded - start).TotalMilliseconds}ms");
}
}
+ if (Banners.Count > 0 && CurrentIndexPublic < 0)
+ {
+ CurrentIndexPublic = 0;
+ }
}
catch (Exception ex)
{
@@ -159,10 +163,18 @@ namespace AIK.ViewModels.HomePage
}
[RelayCommand]
- private void Previous() => CurrentIndexPublic = (CurrentIndexPublic - 1 + Banners.Count) % Banners.Count;
+ private void Previous()
+ {
+ if (Banners.Count == 0) return;
+ CurrentIndexPublic = (CurrentIndexPublic - 1 + Banners.Count) % Banners.Count;
+ }
[RelayCommand]
- private void Next() => CurrentIndexPublic = (CurrentIndexPublic + 1) % Banners.Count;
+ private void Next()
+ {
+ if (Banners.Count == 0) return;
+ CurrentIndexPublic = (CurrentIndexPublic + 1) % Banners.Count;
+ }
[RelayCommand]
private void SelectBanner(int index) => CurrentIndexPublic = index;