add:软件启动动画
This commit is contained in:
+66
-27
@@ -420,7 +420,7 @@ namespace Ink_Canvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增:关闭启动画面
|
// 关闭启动画面
|
||||||
public static void CloseSplashScreen()
|
public static void CloseSplashScreen()
|
||||||
{
|
{
|
||||||
if (!_isSplashScreenShown || _splashScreen == null) return;
|
if (!_isSplashScreenShown || _splashScreen == null) return;
|
||||||
@@ -437,7 +437,7 @@ namespace Ink_Canvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增:设置启动画面进度
|
// 设置启动画面进度
|
||||||
public static void SetSplashProgress(int progress)
|
public static void SetSplashProgress(int progress)
|
||||||
{
|
{
|
||||||
if (_splashScreen != null)
|
if (_splashScreen != null)
|
||||||
@@ -446,7 +446,7 @@ namespace Ink_Canvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增:设置启动画面消息
|
// 设置启动画面消息
|
||||||
public static void SetSplashMessage(string message)
|
public static void SetSplashMessage(string message)
|
||||||
{
|
{
|
||||||
if (_splashScreen != null)
|
if (_splashScreen != null)
|
||||||
@@ -455,7 +455,33 @@ namespace Ink_Canvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增:记录崩溃日志
|
private static bool ShouldShowSplashScreen()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 检查设置文件中的启动动画开关
|
||||||
|
var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "Settings.json");
|
||||||
|
if (File.Exists(settingsPath))
|
||||||
|
{
|
||||||
|
var json = File.ReadAllText(settingsPath);
|
||||||
|
dynamic obj = JsonConvert.DeserializeObject(json);
|
||||||
|
if (obj?["appearance"]?["enableSplashScreen"] != null)
|
||||||
|
{
|
||||||
|
return (bool)obj["appearance"]["enableSplashScreen"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果设置文件不存在或没有该设置,返回默认值false
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile($"检查启动动画设置失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 记录崩溃日志
|
||||||
private static void WriteCrashLog(string message)
|
private static void WriteCrashLog(string message)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -490,7 +516,6 @@ namespace Ink_Canvas
|
|||||||
// 增加字段保存崩溃后操作设置
|
// 增加字段保存崩溃后操作设置
|
||||||
public static CrashActionType CrashAction = CrashActionType.SilentRestart;
|
public static CrashActionType CrashAction = CrashActionType.SilentRestart;
|
||||||
|
|
||||||
// 修正:允许静态调用
|
|
||||||
public static void SyncCrashActionFromSettings()
|
public static void SyncCrashActionFromSettings()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -554,13 +579,16 @@ namespace Ink_Canvas
|
|||||||
// 初始化应用启动时间
|
// 初始化应用启动时间
|
||||||
appStartTime = DateTime.Now;
|
appStartTime = DateTime.Now;
|
||||||
|
|
||||||
// 显示启动画面
|
// 根据设置决定是否显示启动画面
|
||||||
ShowSplashScreen();
|
if (ShouldShowSplashScreen())
|
||||||
SetSplashMessage("正在启动 Ink Canvas...");
|
{
|
||||||
SetSplashProgress(10);
|
ShowSplashScreen();
|
||||||
|
SetSplashMessage("正在启动 Ink Canvas...");
|
||||||
|
SetSplashProgress(10);
|
||||||
|
|
||||||
// 强制刷新UI,确保启动画面显示
|
// 强制刷新UI,确保启动画面显示
|
||||||
Application.Current.Dispatcher.Invoke(() => { }, DispatcherPriority.Render);
|
Application.Current.Dispatcher.Invoke(() => { }, DispatcherPriority.Render);
|
||||||
|
}
|
||||||
|
|
||||||
System.Threading.Thread.Sleep(1000);
|
System.Threading.Thread.Sleep(1000);
|
||||||
RootPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
|
RootPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
|
||||||
@@ -586,9 +614,12 @@ namespace Ink_Canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 在应用启动时自动释放IACore相关DLL
|
// 在应用启动时自动释放IACore相关DLL
|
||||||
SetSplashMessage("正在初始化组件...");
|
if (_isSplashScreenShown)
|
||||||
SetSplashProgress(20);
|
{
|
||||||
await Task.Delay(500);
|
SetSplashMessage("正在初始化组件...");
|
||||||
|
SetSplashProgress(20);
|
||||||
|
await Task.Delay(500);
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IACoreDllExtractor.ExtractIACoreDlls();
|
IACoreDllExtractor.ExtractIACoreDlls();
|
||||||
@@ -599,9 +630,12 @@ namespace Ink_Canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 记录应用启动(设备标识符)
|
// 记录应用启动(设备标识符)
|
||||||
SetSplashMessage("正在加载配置...");
|
if (_isSplashScreenShown)
|
||||||
SetSplashProgress(40);
|
{
|
||||||
await Task.Delay(500);
|
SetSplashMessage("正在加载配置...");
|
||||||
|
SetSplashProgress(40);
|
||||||
|
await Task.Delay(500);
|
||||||
|
}
|
||||||
DeviceIdentifier.RecordAppLaunch();
|
DeviceIdentifier.RecordAppLaunch();
|
||||||
LogHelper.WriteLogToFile($"App | 设备ID: {DeviceIdentifier.GetDeviceId()}");
|
LogHelper.WriteLogToFile($"App | 设备ID: {DeviceIdentifier.GetDeviceId()}");
|
||||||
LogHelper.WriteLogToFile($"App | 使用频率: {DeviceIdentifier.GetUsageFrequency()}");
|
LogHelper.WriteLogToFile($"App | 使用频率: {DeviceIdentifier.GetUsageFrequency()}");
|
||||||
@@ -829,23 +863,28 @@ namespace Ink_Canvas
|
|||||||
StartArgs = e.Args;
|
StartArgs = e.Args;
|
||||||
|
|
||||||
// 在非更新模式下创建主窗口
|
// 在非更新模式下创建主窗口
|
||||||
SetSplashMessage("正在初始化主界面...");
|
if (_isSplashScreenShown)
|
||||||
SetSplashProgress(80);
|
{
|
||||||
await Task.Delay(500);
|
SetSplashMessage("正在初始化主界面...");
|
||||||
|
SetSplashProgress(80);
|
||||||
|
await Task.Delay(500);
|
||||||
|
}
|
||||||
var mainWindow = new MainWindow();
|
var mainWindow = new MainWindow();
|
||||||
MainWindow = mainWindow;
|
MainWindow = mainWindow;
|
||||||
|
|
||||||
// 主窗口加载完成后关闭启动画面
|
// 主窗口加载完成后关闭启动画面
|
||||||
mainWindow.Loaded += (s, args) =>
|
mainWindow.Loaded += (s, args) =>
|
||||||
{
|
{
|
||||||
SetSplashMessage("启动完成!");
|
if (_isSplashScreenShown)
|
||||||
SetSplashProgress(100);
|
|
||||||
|
|
||||||
// 延迟关闭启动画面,让用户看到完成消息
|
|
||||||
Task.Delay(500).ContinueWith(_ =>
|
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() => CloseSplashScreen());
|
SetSplashMessage("启动完成!");
|
||||||
});
|
SetSplashProgress(500);
|
||||||
|
|
||||||
|
Task.Delay(500).ContinueWith(_ =>
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(() => CloseSplashScreen());
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mainWindow.Show();
|
mainWindow.Show();
|
||||||
|
|||||||
@@ -1040,6 +1040,13 @@
|
|||||||
<ComboBoxItem Content="跟随系统" FontFamily="Microsoft YaHei UI" />
|
<ComboBoxItem Content="跟随系统" FontFamily="Microsoft YaHei UI" />
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</ui:SimpleStackPanel>
|
</ui:SimpleStackPanel>
|
||||||
|
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||||
|
<TextBlock Foreground="#fafafa" Text="启用启动动画" VerticalAlignment="Center"
|
||||||
|
FontSize="14" Margin="0,0,16,0" />
|
||||||
|
<ui:ToggleSwitch OnContent="" OffContent="" Name="ToggleSwitchEnableSplashScreen"
|
||||||
|
IsOn="False" FontFamily="Microsoft YaHei UI" FontWeight="Bold"
|
||||||
|
Toggled="ToggleSwitchEnableSplashScreen_Toggled" />
|
||||||
|
</ui:SimpleStackPanel>
|
||||||
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0"
|
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0"
|
||||||
Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4" />
|
Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4" />
|
||||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||||
|
|||||||
@@ -186,6 +186,13 @@ namespace Ink_Canvas
|
|||||||
SaveSettingsToFile();
|
SaveSettingsToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ToggleSwitchEnableSplashScreen_Toggled(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!isLoaded) return;
|
||||||
|
Settings.Appearance.EnableSplashScreen = ToggleSwitchEnableSplashScreen.IsOn;
|
||||||
|
SaveSettingsToFile();
|
||||||
|
}
|
||||||
|
|
||||||
private void ViewboxFloatingBarScaleTransformValueSlider_ValueChanged(object sender, RoutedEventArgs e)
|
private void ViewboxFloatingBarScaleTransformValueSlider_ValueChanged(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!isLoaded) return;
|
if (!isLoaded) return;
|
||||||
|
|||||||
@@ -332,6 +332,8 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
ToggleSwitchEnableQuickPanel.IsOn = Settings.Appearance.IsShowQuickPanel;
|
ToggleSwitchEnableQuickPanel.IsOn = Settings.Appearance.IsShowQuickPanel;
|
||||||
|
|
||||||
|
ToggleSwitchEnableSplashScreen.IsOn = Settings.Appearance.EnableSplashScreen;
|
||||||
|
|
||||||
ToggleSwitchEnableTrayIcon.IsOn = Settings.Appearance.EnableTrayIcon;
|
ToggleSwitchEnableTrayIcon.IsOn = Settings.Appearance.EnableTrayIcon;
|
||||||
ICCTrayIconExampleImage.Visibility =
|
ICCTrayIconExampleImage.Visibility =
|
||||||
Settings.Appearance.EnableTrayIcon ? Visibility.Visible : Visibility.Collapsed;
|
Settings.Appearance.EnableTrayIcon ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
|||||||
@@ -199,6 +199,8 @@ namespace Ink_Canvas
|
|||||||
public int UnFoldButtonImageType { get; set; }
|
public int UnFoldButtonImageType { get; set; }
|
||||||
[JsonProperty("isShowLRSwitchButton")]
|
[JsonProperty("isShowLRSwitchButton")]
|
||||||
public bool IsShowLRSwitchButton { get; set; }
|
public bool IsShowLRSwitchButton { get; set; }
|
||||||
|
[JsonProperty("enableSplashScreen")]
|
||||||
|
public bool EnableSplashScreen { get; set; } = false;
|
||||||
[JsonProperty("isShowQuickPanel")]
|
[JsonProperty("isShowQuickPanel")]
|
||||||
public bool IsShowQuickPanel { get; set; } = true;
|
public bool IsShowQuickPanel { get; set; } = true;
|
||||||
[JsonProperty("chickenSoupSource")]
|
[JsonProperty("chickenSoupSource")]
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user