diff --git a/App.xaml.cs b/App.xaml.cs index 159fbd1..7ec5514 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -4,6 +4,7 @@ namespace Ona_Pix { public partial class App : Application { + //程序启动事件 protected override void OnStartup(StartupEventArgs e) { Define.MAIN_WINDOW = new(e.Args); diff --git a/Commons/Define.cs b/Commons/Define.cs index 00c0cf8..22f1e81 100644 --- a/Commons/Define.cs +++ b/Commons/Define.cs @@ -3,6 +3,7 @@ using System.IO; using System.Net.Http; using System.Reflection; +using Ona_Pix.Pages; namespace Ona_Pix { @@ -16,6 +17,10 @@ internal static class Define internal static MainWindow? MAIN_WINDOW; internal static readonly SettingWindow SETTING_WINDOW = new(); + //页面 + internal static readonly AppearancePage APPEARANCE_PAGE = (AppearancePage)SETTING_WINDOW.Resources["appearancePage"]; + internal static readonly BehaviorPage BEHAVIOR_PAGE = (BehaviorPage)SETTING_WINDOW.Resources["behaviorPage"]; + //字段 internal static readonly HttpClient MAIN_CLIENT = new(); internal static readonly string CURRENT_VERSION = Assembly.GetExecutingAssembly().GetName().Version!.ToString()[0..^2]; diff --git a/Commons/IconRemover.cs b/Commons/IconRemover.cs index e5413e5..1a932d6 100644 --- a/Commons/IconRemover.cs +++ b/Commons/IconRemover.cs @@ -5,6 +5,7 @@ namespace Ona_Pix { + //定义IconRemover internal static class IconRemover { private const int GWL_EXSTYLE = -20; @@ -41,6 +42,7 @@ internal static void RemoveIcon(Window window) } } + //使用IconRemover public partial class MainWindow { protected override void OnSourceInitialized(EventArgs e) diff --git a/Commons/Smms.cs b/Commons/Smms.cs index b9da813..8d02d7b 100644 --- a/Commons/Smms.cs +++ b/Commons/Smms.cs @@ -20,8 +20,10 @@ public Smms() : base("Ona-Pix-Smms.exe") //Control.CheckForIllegalCrossThreadCalls = false; } + //Smms程序调用事件 public override async void Process_OutputDataReceived(object sender, DataReceivedEventArgs e) { + //输出事件(输出结果) try { if (!string.IsNullOrEmpty(e.Data) && !string.IsNullOrWhiteSpace(e.Data)) @@ -55,6 +57,7 @@ public override async void Process_OutputDataReceived(object sender, DataReceive } public override void Process_ErrorDataReceived(object sender, DataReceivedEventArgs e) { + //报错事件(输出错误) if (!string.IsNullOrEmpty(e.Data) && !string.IsNullOrWhiteSpace(e.Data)) { ShowError!(e.Data); @@ -63,6 +66,7 @@ public override void Process_ErrorDataReceived(object sender, DataReceivedEventA } public override void Process_Exited(object sender, EventArgs e) { + //退出事件 SetControlsEnabled!(); } } diff --git a/Commons/Updater.cs b/Commons/Updater.cs index 46b99bc..82517ce 100644 --- a/Commons/Updater.cs +++ b/Commons/Updater.cs @@ -19,8 +19,10 @@ private void PartialAboutWindow() GITHUB_CLIENT.DefaultRequestHeaders.Add("User-Agent", Define.USER_AGENT_HEADER); } + //用户交互流程 private async void UpdateLink_Click(object sender, RoutedEventArgs e) { + //用户点击关于页面的版本号 try { Title = "正在获取更新"; @@ -59,6 +61,7 @@ private async void UpdateLink_Click(object sender, RoutedEventArgs e) } private async void ReleaseListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { + //用户选择下载内容 Title = "继续执行更新"; try diff --git a/Controls/ToggleSwitch.xaml.cs b/Controls/ToggleSwitch.xaml.cs index 802a434..74a895e 100644 --- a/Controls/ToggleSwitch.xaml.cs +++ b/Controls/ToggleSwitch.xaml.cs @@ -19,6 +19,7 @@ public ToggleSwitch() InitializeComponent(); } + //点击事件 private void ForeDot_MouseDown(object sender, MouseButtonEventArgs e) { SwitchStatus(); @@ -28,6 +29,7 @@ private void BackRec_MouseDown(object sender, MouseButtonEventArgs e) SwitchStatus(); } + //切换Toggle状态 internal void SwitchStatus() { if (!IS_TOGGLED) diff --git a/Pages/AppearancePage.xaml b/Pages/AppearancePage.xaml index a69929b..e4835c2 100644 --- a/Pages/AppearancePage.xaml +++ b/Pages/AppearancePage.xaml @@ -27,7 +27,7 @@ -