private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (DataUtil.Config.sysConfig.exitConfirm && MessageBox.Show("是否确定要退出团长助理?", "退出确认", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { e.Cancel = true; return; } timerCheck.Dispose(); timerClock.Dispose(); timerAuto.Dispose(); if (DataUtil.Config.sysConfig.enableHotKey) { IntPtr handle = new WindowInteropHelper(this).Handle; HotKeyHelper.UnregisterHotKey(handle, HotKeyHelper.hotKeyId); } if (SoundHelper.isMute) { SoundHelper.Mute(); } if (notifyIcon != null) { notifyIcon.Dispose(); notifyIcon = null; } }
private void notifyIcon_DoubleClick(object sender, EventArgs e) { Show(); WindowState = WindowState.Normal; Activate(); if (!DataUtil.Config.sysConfig.alwaysShowTray) { notifyIcon.Visible = false; } if (DataUtil.Config.sysConfig.miniToMute && SoundHelper.isMute && !SoundHelper.userMute) { SoundHelper.Mute(); } }
/// <summary> /// 手动静音/恢复声音 /// </summary> private void MuteSound() { SoundHelper.Mute(true); if (SoundHelper.isMute) { btnMute.Visibility = Visibility.Hidden; btnUnMute.Visibility = Visibility.Visible; } else { btnMute.Visibility = Visibility.Visible; btnUnMute.Visibility = Visibility.Hidden; } }
private void MetroWindow_StateChanged(object sender, EventArgs e) { if (WindowState == WindowState.Minimized) { if (DataUtil.Config.sysConfig.miniToTray) { Hide(); notifyIcon.Visible = true; } if (DataUtil.Config.sysConfig.miniToMute && !SoundHelper.isMute && !SoundHelper.userMute) { SoundHelper.Mute(); } } }