void Window1_Loaded(object sender, RoutedEventArgs e) { _device= new XkeysKeyboardDevice(); _device.DeviceClosed += () => { this.Dispatcher.Invoke(new Action(() => { this.Title = "Closed"; })); }; }
public Light() { InitializeComponent(); _device = new XkeysKeyboardDevice(); _device.TryOpen(SupportedXkeysKeyboardDevice.XK80); this.Closing += Light_Closed; _device.w = this; this.SourceInitialized += (s, e) => { var hwnd = new WindowInteropHelper(this).Handle; var value = GetWindowLong(hwnd, GWL_STYLE); SetWindowLong(hwnd, GWL_STYLE, (int)(value & WS_MINIMIZE)); }; }