/// <summary> /// 窗口打开时执行的 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { HwndSource hWndSource; WindowInteropHelper wih = new WindowInteropHelper(this); hWndSource = HwndSource.FromHwnd(wih.Handle); //添加处理程序 hWndSource.AddHook(MainWindowProc); Identification = HotKey.GlobalAddAtom("Shift-S"); HotKey.RegisterHotKey(wih.Handle, Identification, HotKey.KeyModifiers.Shift, (int)System.Windows.Forms.Keys.S); //软件更新 DataFetch.SoftwareUpdate(); }