protected virtual void Window_Loaded(object sender, RoutedEventArgs e) { _TataruModel.FFMemoryReader.AddExclusionWindowHandler((new WindowInteropHelper(this).Handle)); _MouseHooker = null; AutoHideStatusCheck(); //_MouseHooker = new MouseHooker(); //_MouseHooker.LowLevelMouseEvent += OnLowLevelMousEvent; }
static void Connected(BabylonMS.BMSEventSessionParameter psession) { if (debug) { Console.WriteLine("InputController Connected."); } session = psession; hook = new MouseHooker(); }
protected virtual async Task OnBackgroundColorChange(ColorChangeEventArgs ea) { await this.UIThreadAsync(() => { if (((SolidColorBrush)this.Background).Color != ea.NewColor) { this.Background = new SolidColorBrush(ea.NewColor); if (_TataruUIModel.IsChatClickThrough) { MakeWindowClickThrought(); } if (((SolidColorBrush)this.Background).Color.A == 0) { try { if (_MouseHooker != null) { _MouseHooker.LowLevelMouseEvent -= OnLowLevelMousEvent; _MouseHooker.Dispose(); _MouseHooker = null; } _MouseHooker = new MouseHooker(); _MouseHooker.LowLevelMouseEvent += OnLowLevelMousEvent; } catch (Exception e) { Logger.WriteLog(e); } } else { if (_MouseHooker != null) { try { _MouseHooker.LowLevelMouseEvent -= OnLowLevelMousEvent; _MouseHooker.Dispose(); _MouseHooker = null; } catch (Exception e) { Logger.WriteLog(e); } } }//*/ } }); }
static void Main(string[] args) { _handler += new EventHandler(Handler); SetConsoleCtrlHandler(_handler, true); Application.EnableVisualStyles(); User32.HideMouse(); User32.ShowMouse(); bms = BabylonMS.BabylonMS.ShipDocking(shipUUID, args); bms.Connected += Connected; bms.Disconnected += Disconnected; bms.NewInputFrame += NewInputFrame; bms.Waitbytes += WaitBytes; bms.WaitBytesMS = 5; bms.OpenGate(false); //Client //BabylonMS.Util.setPriorityUp(); if (TEST_INPUTCONTROLLER) { hook = new MouseHooker(); //for test because the Connect activate the Mousehooker } Application.Run(); //Application.Run(new Form1()); while (true) { try { Thread.Sleep(5); for (int i = 0; i < 4; i++) { Application.DoEvents(); } } catch (Exception) { } } }
private static Task <Point> GetPointAsync() { var tcs = new TaskCompletionSource <Point>(); var hooker = new MouseHooker(); hooker.EventReceived += (status, point) => { if (status == 514) { tcs.TrySetResult(point); Application.Exit(); } }; Task.Run(() => { hooker.Start(); Application.Run(); hooker.Stop(); }); return(tcs.Task); }
protected virtual void Window_Loaded(object sender, RoutedEventArgs e) { _MouseHooker = null; AutoHideStatusCheck(); _TataruModel.FFMemoryReader.AddExclusionWindowHandler((new WindowInteropHelper(this).Handle)); if (_ChatWindowViewModel.IsClickThrough) { MakeWindowClickThrought(); } else { MakeWindowClickbale(); } _ChatWindowViewModel.AsyncPropertyChanged += OnSettingsWindowPropertyChange; _ChatWindowViewModel.RequestChatClear += OnChatClearRequest; _TataruModel.ChatProcessor.TextArrived += OnTextArrived; _TataruModel.FFMemoryReader.FFWindowStateChanged += OnFFWindowStateChange; }
static void Disconnected(BabylonMS.BMSEventSessionParameter session) { hook.destroy(); hook = null; }