diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index bad7f58..9c12cc6 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -1890,6 +1890,16 @@ namespace VPet_Simulator.Windows Checked = HitThrough }; m_menu.Items.Add(hitThrough); + var topmost = new MenuItem("置于顶层".Translate(), null, (x, y) => + { + Topmost = ((MenuItem)x).Checked; + }) + { + Name = "NotifyIcon_TopMost", + CheckOnClick = true, + Checked = Topmost + }; + m_menu.Items.Add(topmost); m_menu.Items.Add(new MenuItem("操作教程".Translate(), null, (x, y) => { if (LocalizeCore.CurrentCulture == "zh-Hans") diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 81df605..a6efa68 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -31,7 +31,7 @@ namespace VPet_Simulator.Windows /// public partial class MainWindow : WindowX { - private System.Windows.Forms.NotifyIcon notifyIcon; + internal System.Windows.Forms.NotifyIcon notifyIcon; public PetHelper petHelper; public System.Timers.Timer AutoSaveTimer = new System.Timers.Timer(); @@ -62,7 +62,7 @@ namespace VPet_Simulator.Windows LocalizeCore.TranslateFunc = (str) => { var destr = Sub.TextDeReplace(str); - if(destr == str) + if (destr == str) return str; return destr.Translate(); }; diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs index 8b3cbef..104d27e 100644 --- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs @@ -805,6 +805,7 @@ namespace VPet_Simulator.Windows if (!AllowChange) return; mw.Set.TopMost = true; + (mw.notifyIcon.ContextMenuStrip.Items.Find("NotifyIcon_TopMost", false).First() as System.Windows.Forms.ToolStripMenuItem).Checked = true; } private void TopMostBox_Unchecked(object sender, RoutedEventArgs e) @@ -812,6 +813,7 @@ namespace VPet_Simulator.Windows if (!AllowChange) return; mw.Set.TopMost = false; + (mw.notifyIcon.ContextMenuStrip.Items.Find("NotifyIcon_TopMost", false).First() as System.Windows.Forms.ToolStripMenuItem).Checked = false; } private void ZoomSlider_MouseUp(object sender, MouseButtonEventArgs e)