[add] Function FoldAtStartup

This commit is contained in:
ChanginJolly 2024-03-10 17:50:22 +08:00
parent 3f42652672
commit d281431535
4 changed files with 23 additions and 5 deletions

View File

@ -795,6 +795,8 @@
</Border>
<ui:ToggleSwitch Name="ToggleSwitchRunAtStartup" Header="开机时运行" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchRunAtStartup_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchFoldAtStartup" Header="开机运行后收纳到侧边栏" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchFoldAtStartup_Toggled"/>
<!--
<ui:ToggleSwitch Name="ToggleSwitchAutoHideCanvas" Header="自动隐藏画板" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchAutoHideCanvas_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchAutoEnterModeFinger" Header="自动进入手指模式" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchAutoEnterModeFinger_Toggled"/>

View File

@ -543,9 +543,6 @@ namespace Ink_Canvas {
// Startup
if (isStartup) {
CursorIcon_Click(null, null);
if (Settings.Automation.AutoDelSavedFiles) {
DelAutoSavedFiles.DeleteFilesOlder(Settings.Automation.AutoSavedStrokesLocation, Settings.Automation.AutoDelSavedFilesDaysThreshold);
}
}
try {
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\Ink Canvas Annotation.lnk")) {
@ -555,6 +552,14 @@ namespace Ink_Canvas {
LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error);
}
if (Settings.Startup != null) {
if (isStartup) {
if (Settings.Automation.AutoDelSavedFiles) {
DelAutoSavedFiles.DeleteFilesOlder(Settings.Automation.AutoSavedStrokesLocation, Settings.Automation.AutoDelSavedFilesDaysThreshold);
}
if (Settings.Startup.IsFoldAtStartup) {
FoldFloatingBar_MouseUp(Fold_Icon, null);
}
}
if (Settings.Startup.IsEnableNibMode) {
ToggleSwitchEnableNibMode.IsOn = true;
ToggleSwitchBoardEnableNibMode.IsOn = true;
@ -580,6 +585,8 @@ namespace Ink_Canvas {
AutoUpdateWithSilenceTimeComboBox.InitializeAutoUpdateWithSilenceTimeComboBoxOptions(AutoUpdateWithSilenceStartTimeComboBox, AutoUpdateWithSilenceEndTimeComboBox);
AutoUpdateWithSilenceStartTimeComboBox.SelectedItem = Settings.Startup.AutoUpdateWithSilenceStartTime;
AutoUpdateWithSilenceEndTimeComboBox.SelectedItem = Settings.Startup.AutoUpdateWithSilenceEndTime;
ToggleSwitchFoldAtStartup.IsOn = Settings.Startup.IsFoldAtStartup;
} else {
Settings.Startup = new Startup();
}
@ -2587,6 +2594,12 @@ namespace Ink_Canvas {
}
}
private void ToggleSwitchFoldAtStartup_Toggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;
Settings.Startup.IsFoldAtStartup = ToggleSwitchFoldAtStartup.IsOn;
SaveSettingsToFile();
}
private void ToggleSwitchSupportPowerPoint_Toggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;
@ -3259,6 +3272,7 @@ namespace Ink_Canvas {
Settings.Startup.AutoUpdateProxy = "https://mirror.ghproxy.com/";
Settings.Startup.AutoUpdateWithSilenceStartTime = "18:20";
Settings.Startup.AutoUpdateWithSilenceEndTime = "07:40";
Settings.Startup.IsFoldAtStartup = false;
}
private void BtnResetToSuggestion_Click(object sender, RoutedEventArgs e) {

View File

@ -49,5 +49,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.5.2.0")]
[assembly: AssemblyFileVersion("4.5.2.0")]
[assembly: AssemblyVersion("4.5.3.0")]
[assembly: AssemblyFileVersion("4.5.3.0")]

View File

@ -93,6 +93,8 @@ namespace Ink_Canvas
public bool IsAutoHideCanvas { get; set; } = true;
[JsonProperty("isAutoEnterModeFinger")]
public bool IsAutoEnterModeFinger { get; set; } = false;*/
[JsonProperty("isFoldAtStartup")]
public bool IsFoldAtStartup { get; set; } = false;
}
public class Appearance