Skip to content

Commit

Permalink
fix: 优化更新文字提示的时机
Browse files Browse the repository at this point in the history
  • Loading branch information
Blinue committed Jan 14, 2022
1 parent 2ffe86e commit bc590f1
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions Magpie/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,9 @@ public MainWindow() {
cbbScaleMode.SelectionChanged += CbbScaleMode_SelectionChanged;
cbbCaptureMethod.SelectionChanged += CbbCaptureMethod_SelectionChanged;
}

void UpdateNotifyIconText() {
notifyIcon.Text = string.Format(
Properties.Resources.UI_SysTray_Text,
Settings.Default.Hotkey,
cbbScaleMode.SelectedItem?.ToString(),
((ComboBoxItem)cbbCaptureMethod.SelectedItem)?.Content.ToString()
);
}

void InitNotifyIcon() {
notifyIcon.Visible = false;

UpdateNotifyIconText();
notifyIcon.MouseClick += NotifyIcon_MouseClick;

ContextMenuStrip menu = new();
Expand Down Expand Up @@ -400,7 +389,14 @@ private void ToggleScaleTimer() {

private void Window_StateChanged(object sender, EventArgs e) {
if (WindowState == WindowState.Minimized) {
UpdateNotifyIconText();
// 更新文字提示
notifyIcon.Text = string.Format(
Properties.Resources.UI_SysTray_Text,
Settings.Default.Hotkey,
cbbScaleMode.SelectedItem?.ToString(),
((ComboBoxItem)cbbCaptureMethod.SelectedItem)?.Content.ToString()
);

Hide();
notifyIcon.Visible = true;
} else {
Expand Down

0 comments on commit bc590f1

Please sign in to comment.