diff --git a/Ink Canvas/InkCanvasForClass.csproj b/Ink Canvas/InkCanvasForClass.csproj index 743c0b68..c2576703 100644 --- a/Ink Canvas/InkCanvasForClass.csproj +++ b/Ink Canvas/InkCanvasForClass.csproj @@ -575,7 +575,11 @@ + + + + diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml index 453e6421..a7d9cec8 100644 --- a/Ink Canvas/MainWindow.xaml +++ b/Ink Canvas/MainWindow.xaml @@ -1047,6 +1047,21 @@ IsOn="False" FontFamily="Microsoft YaHei UI" FontWeight="Bold" Toggled="ToggleSwitchEnableSplashScreen_Toggled" /> + + + + + + + + + + + + diff --git a/Ink Canvas/MainWindow_cs/MW_Settings.cs b/Ink Canvas/MainWindow_cs/MW_Settings.cs index 4b30d65d..dd5391e5 100644 --- a/Ink Canvas/MainWindow_cs/MW_Settings.cs +++ b/Ink Canvas/MainWindow_cs/MW_Settings.cs @@ -193,6 +193,13 @@ namespace Ink_Canvas SaveSettingsToFile(); } + private void ComboBoxSplashScreenStyle_SelectionChanged(object sender, RoutedEventArgs e) + { + if (!isLoaded) return; + Settings.Appearance.SplashScreenStyle = ComboBoxSplashScreenStyle.SelectedIndex; + SaveSettingsToFile(); + } + private void ViewboxFloatingBarScaleTransformValueSlider_ValueChanged(object sender, RoutedEventArgs e) { if (!isLoaded) return; diff --git a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs index d34d0ce4..0653fd3a 100644 --- a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs +++ b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs @@ -334,6 +334,8 @@ namespace Ink_Canvas ToggleSwitchEnableSplashScreen.IsOn = Settings.Appearance.EnableSplashScreen; + ComboBoxSplashScreenStyle.SelectedIndex = Settings.Appearance.SplashScreenStyle; + ToggleSwitchEnableTrayIcon.IsOn = Settings.Appearance.EnableTrayIcon; ICCTrayIconExampleImage.Visibility = Settings.Appearance.EnableTrayIcon ? Visibility.Visible : Visibility.Collapsed; diff --git a/Ink Canvas/Resources/ICC Start.png b/Ink Canvas/Resources/ICC Start.png deleted file mode 100644 index d21d0dc0..00000000 Binary files a/Ink Canvas/Resources/ICC Start.png and /dev/null differ diff --git a/Ink Canvas/Resources/Settings.cs b/Ink Canvas/Resources/Settings.cs index 88a7a36a..8180f5f3 100644 --- a/Ink Canvas/Resources/Settings.cs +++ b/Ink Canvas/Resources/Settings.cs @@ -200,7 +200,9 @@ namespace Ink_Canvas [JsonProperty("isShowLRSwitchButton")] public bool IsShowLRSwitchButton { get; set; } [JsonProperty("enableSplashScreen")] - public bool EnableSplashScreen { get; set; } = false; + public bool EnableSplashScreen { get; set; } = false; + [JsonProperty("splashScreenStyle")] + public int SplashScreenStyle { get; set; } = 1; // 0-随机, 1-跟随四季, 2-春季, 3-夏季, 4-秋季, 5-冬季, 6-马年限定 [JsonProperty("isShowQuickPanel")] public bool IsShowQuickPanel { get; set; } = true; [JsonProperty("chickenSoupSource")] diff --git a/Ink Canvas/Resources/Startup-animation/ICC Autumn.png b/Ink Canvas/Resources/Startup-animation/ICC Autumn.png new file mode 100644 index 00000000..e3883253 Binary files /dev/null and b/Ink Canvas/Resources/Startup-animation/ICC Autumn.png differ diff --git a/Ink Canvas/Resources/Startup-animation/ICC Horse.png b/Ink Canvas/Resources/Startup-animation/ICC Horse.png new file mode 100644 index 00000000..22eee7be Binary files /dev/null and b/Ink Canvas/Resources/Startup-animation/ICC Horse.png differ diff --git a/Ink Canvas/Resources/Startup-animation/ICC Spring.png b/Ink Canvas/Resources/Startup-animation/ICC Spring.png new file mode 100644 index 00000000..011ad569 Binary files /dev/null and b/Ink Canvas/Resources/Startup-animation/ICC Spring.png differ diff --git a/Ink Canvas/Resources/Startup-animation/ICC Summer.png b/Ink Canvas/Resources/Startup-animation/ICC Summer.png new file mode 100644 index 00000000..c8d1d800 Binary files /dev/null and b/Ink Canvas/Resources/Startup-animation/ICC Summer.png differ diff --git a/Ink Canvas/Resources/Startup-animation/ICC Winter.png b/Ink Canvas/Resources/Startup-animation/ICC Winter.png new file mode 100644 index 00000000..17e9e70b Binary files /dev/null and b/Ink Canvas/Resources/Startup-animation/ICC Winter.png differ diff --git a/Ink Canvas/Windows/SplashScreen.xaml b/Ink Canvas/Windows/SplashScreen.xaml index 1809307a..4949f84a 100644 --- a/Ink Canvas/Windows/SplashScreen.xaml +++ b/Ink Canvas/Windows/SplashScreen.xaml @@ -19,7 +19,6 @@ diff --git a/Ink Canvas/Windows/SplashScreen.xaml.cs b/Ink Canvas/Windows/SplashScreen.xaml.cs index 8e70733e..8af10ab9 100644 --- a/Ink Canvas/Windows/SplashScreen.xaml.cs +++ b/Ink Canvas/Windows/SplashScreen.xaml.cs @@ -5,6 +5,8 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Media.Animation; using System.Windows.Threading; +using System.IO; +using Newtonsoft.Json; namespace Ink_Canvas.Windows { @@ -27,6 +29,7 @@ namespace Ink_Canvas.Windows { InitializeComponent(); InitializeSplashScreen(); + LoadSplashImage(); } private void InitializeSplashScreen() @@ -152,5 +155,91 @@ namespace Ink_Canvas.Windows VersionTextBlock.Text = "v5.0.4.0"; } } + + /// + /// 加载启动图片 + /// + private void LoadSplashImage() + { + try + { + string imagePath = GetSplashImagePath(); + if (!string.IsNullOrEmpty(imagePath)) + { + StartupImage.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(imagePath)); + } + } + catch (Exception ex) + { + // 如果加载失败,使用默认图片 + System.Diagnostics.Debug.WriteLine($"加载启动图片失败: {ex.Message}"); + } + } + + /// + /// 根据设置获取启动图片路径 + /// + private string GetSplashImagePath() + { + try + { + // 读取设置 + var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "Settings.json"); + int splashStyle = 1; // 默认跟随四季 + + if (File.Exists(settingsPath)) + { + var json = File.ReadAllText(settingsPath); + dynamic obj = JsonConvert.DeserializeObject(json); + if (obj?["appearance"]?["splashScreenStyle"] != null) + { + splashStyle = (int)obj["appearance"]["splashScreenStyle"]; + } + } + + // 根据样式选择图片 + string imageName = GetImageNameByStyle(splashStyle); + return $"pack://application:,,,/Resources/Startup-animation/{imageName}"; + } + catch + { + string imageName = GetImageNameByStyle(1); + return $"pack://application:,,,/Resources/Startup-animation/{imageName}"; + } + } + + /// + /// 根据样式获取图片名称 + /// + private string GetImageNameByStyle(int style) + { + switch (style) + { + case 0: // 随机 + var random = new Random(); + var randomStyles = new[] { 2, 3, 4, 5, 6 }; // 春季、夏季、秋季、冬季、马年限定 + return GetImageNameByStyle(randomStyles[random.Next(randomStyles.Length)]); + + case 1: // 跟随四季 + var month = DateTime.Now.Month; + if (month >= 3 && month <= 5) return GetImageNameByStyle(2); // 春季 + if (month >= 6 && month <= 8) return GetImageNameByStyle(3); // 夏季 + if (month >= 9 && month <= 11) return GetImageNameByStyle(4); // 秋季 + return GetImageNameByStyle(5); // 冬季 + + case 2: // 春季 + return "ICC Spring.png"; + case 3: // 夏季 + return "ICC Summer.png"; + case 4: // 秋季 + return "ICC Autumn.png"; + case 5: // 冬季 + return "ICC Winter.png"; + case 6: // 马年限定 + return "ICC Horse.png"; + default: + return "ICC Autumn.png"; // 默认秋季 + } + } } } \ No newline at end of file