public static void Main(string [] args) { Cats cats = new Cats("Tom"); Mouses mouses1 = new Mouses("Jack"); Mouses mouses2 = new Mouses("Jerry"); cats.CatShut += new Cats.CatShutEventHandler(mouses1.MouseShut); cats.CatShut += new Cats.CatShutEventHandler(mouses1.Run); cats.CatShut += new Cats.CatShutEventHandler(mouses2.MouseShut); cats.CatShut += new Cats.CatShutEventHandler(mouses2.Run); cats.Shut(); System.Console.ReadKey(); }
public void MouseClicked(object Data, MultiDeviceInput.InputDevice.MouseControlEventArgs e) { MouseData CurrentMouse = Mouses.Find(n => n.Handle == e.DeviceData.Info.deviceHandle); if (CurrentMouse != null) { tbLastMouseName.Text = CurrentMouse.ToString(); } else { tbLastMouseName.Text = "Unknown"; } }
public GameWindow() { InitializeComponent(); Instance = this; Cursor.Hide(); // Multi mouse input init InputDevice = new MultiDeviceInput.InputDevice(Handle); InputDevice.EnumerateDevices(); InputDevice.MouseDown += new MultiDeviceInput.InputDevice.MouseEventHandler(_MouseDown); InputDevice.MouseMove += new MultiDeviceInput.InputDevice.MouseEventHandler(_MouseMove); InputDevice.MouseUp += new MultiDeviceInput.InputDevice.MouseEventHandler(_MouseUp); InputDevice.MouseWheel += new MultiDeviceInput.InputDevice.MouseEventHandler(_MouseWheel); foreach (var KvP in InputDevice.DeviceList) { MouseData NewMouse = new MouseData(); NewMouse.PosX = Canvas.Width / 2; NewMouse.PosY = Canvas.Height / 2; NewMouse.Data = KvP.Value; Mouses.Add(KvP.Value.Info.deviceHandle, NewMouse); } }