add:软件启动动画
This commit is contained in:
@@ -575,7 +575,11 @@
|
||||
<Resource Include="Resources\PresentationExample\sidebar-dark.png" />
|
||||
<Resource Include="Resources\PresentationExample\sidebar-white.png" />
|
||||
<Resource Include="Resources\PresentationExample\toolbar.png" />
|
||||
<Resource Include="Resources\Startup-animation\ICC Spring.png" />
|
||||
<Resource Include="Resources\Startup-animation\ICC Summer.png" />
|
||||
<Resource Include="Resources\Startup-animation\ICC Autumn.png" />
|
||||
<Resource Include="Resources\Startup-animation\ICC Winter.png" />
|
||||
<Resource Include="Resources\Startup-animation\ICC Horse.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
|
||||
@@ -1047,6 +1047,21 @@
|
||||
IsOn="False" FontFamily="Microsoft YaHei UI" FontWeight="Bold"
|
||||
Toggled="ToggleSwitchEnableSplashScreen_Toggled" />
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#fafafa" Text="启动动画样式" VerticalAlignment="Center"
|
||||
FontSize="14" Margin="0,0,16,0" />
|
||||
<ComboBox Name="ComboBoxSplashScreenStyle" FontFamily="Microsoft YaHei UI"
|
||||
SelectedIndex="1" Width="150"
|
||||
SelectionChanged="ComboBoxSplashScreenStyle_SelectionChanged">
|
||||
<ComboBoxItem Content="随机" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="跟随四季" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="春季" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="夏季" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="秋季" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="冬季" FontFamily="Microsoft YaHei UI" />
|
||||
<ComboBoxItem Content="马年限定" FontFamily="Microsoft YaHei UI" />
|
||||
</ComboBox>
|
||||
</ui:SimpleStackPanel>
|
||||
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0"
|
||||
Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4" />
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 556 KiB |
@@ -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")]
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 920 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 923 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 925 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 924 KiB |
@@ -19,7 +19,6 @@
|
||||
<StackPanel>
|
||||
<!-- 启动图片 -->
|
||||
<Image x:Name="StartupImage"
|
||||
Source="pack://application:,,,/Resources/Startup-animation/ICC Autumn.png"
|
||||
Width="600"
|
||||
Height="450"
|
||||
Stretch="Uniform" />
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载启动图片
|
||||
/// </summary>
|
||||
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}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据设置获取启动图片路径
|
||||
/// </summary>
|
||||
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}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据样式获取图片名称
|
||||
/// </summary>
|
||||
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"; // 默认秋季
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user