public RabbitMqServer(string rabbitMqHost = "localhost", string rabbitMqUser = "******", string rabbitMqPassword = "******", string rabbitMqVHost = "/") { //Configure our keyboard keyboard = new KeyboardInterface(); keyboard.KeyAction += Keyboard_KeyAction; keyboard.RotaryValueChanged += Keyboard_RotaryValueChanged; keyboard.TBarValueChanged += Keyboard_TBarValueChanged; keyboard.JoystickValueChanged += Keyboard_JoystickValueChanged; //Create our RabbitMQ connection factory rabbitMqFactory = new ConnectionFactory() { HostName = rabbitMqHost, UserName = rabbitMqUser, Password = rabbitMqPassword, VirtualHost = rabbitMqVHost, DispatchConsumersAsync = true }; jsonOptions = new JsonSerializerOptions() { WriteIndented = true, Converters = { new JsonStringEnumConverter() } }; }
static async Task Main(string[] args) { Console.Write("Initializing console connection... "); keyboard = new KeyboardInterface(); if (!await keyboard.StartupAsync()) { Console.WriteLine("Failed. Exiting..."); return; } Console.WriteLine("Success"); keyboard.TBarValueChanged += Keyboard_TBarValueChanged; keyboard.KeyPressed += Keyboard_KeyPressed; keyboard.KeyReleased += Keyboard_KeyReleased; keyboard.RotaryValueChanged += Keyboard_RotaryValueChanged; keyboard.JoystickValueChanged += Keyboard_JoystickValueChanged; keyboard.KeyAction += Keyboard_KeyAction; Console.WriteLine("Listening for events"); Console.WriteLine("Press enter to exit"); Console.ReadLine(); Console.WriteLine("Shutting down..."); await keyboard.ShutdownAsync(); }
private string DisplayKeyboard(string KeyText, string type) { try { LogManager.WriteLog("Inside DisplayKeyboard", LogManager.enumLogLevel.Info); strKeyText = ""; KeyboardInterface objKeyboard = new KeyboardInterface(); if (type == "Pwd") { objKeyboard.IsPwd = true; } objKeyboard.Closing += new System.ComponentModel.CancelEventHandler(objKeyboard_Closing); objKeyboard.KeyString = KeyText; Point locationFromScreen = this.PointToScreen(new Point(0, 0)); PresentationSource source = PresentationSource.FromVisual(this); System.Windows.Point targetPoints = source.CompositionTarget.TransformFromDevice.Transform(locationFromScreen); objKeyboard.Top = targetPoints.Y + this.Height / 2; objKeyboard.Left = targetPoints.X; objKeyboard.ShowDialogEx(this); return(strKeyText); } catch (Exception ex) { ExceptionManager.Publish(ex); return(string.Empty); } }
private string DisplayKeyboard(string KeyText, string type) { try { this.Cursor = Cursors.Wait; strKeyText = ""; KeyboardInterface objKeyboard = new KeyboardInterface(); if (type == "Pwd") { objKeyboard.IsPwd = true; } objKeyboard.Closing += new System.ComponentModel.CancelEventHandler(objKeyboard_Closing); objKeyboard.KeyString = KeyText; Point locationFromScreen = CFactoryReset.FactoryResetInstance.PointToScreen(new Point(0, 0)); PresentationSource source = PresentationSource.FromVisual(this); System.Windows.Point targetPoints = source.CompositionTarget.TransformFromDevice.Transform(locationFromScreen); objKeyboard.Top = targetPoints.Y + CFactoryReset.FactoryResetInstance.Height / 2; objKeyboard.Left = targetPoints.X - 100; objKeyboard.ShowDialog(); return(strKeyText); } finally { this.Cursor = Cursors.Arrow; } }
public static void Main() { KeyboardInterface keyboard = new KeyboardInterface(); DoubleBufferConsoleRenderer consoleRenderer = new DoubleBufferConsoleRenderer(MAX_COLS, MAX_ROWS); engine = new GameEngine(consoleRenderer, keyboard, 150); DisplayConsoleMenu(); }
public string DisplayKeyboard(string keyText, string type) { _sKeyText = ""; using (var objKeyboard = new KeyboardInterface()) { objKeyboard.Closing += ObjKeyboardClosing; objKeyboard.KeyString = keyText; objKeyboard.WindowStartupLocation = WindowStartupLocation.CenterScreen; // objKeyboard.Owner = CprintprmTick; objKeyboard.ShowDialog(); } return(_sKeyText); }
public static void StartEngine() { SetUpConsoleDimentions(); FirstScreen(); var renderer = new ConsoleRenderer(WORLDROWS, WORLDCOLS); var userInterface = new KeyboardInterface(); Engine gameEngine = Engine.EngineInstance(renderer, userInterface); // singleton //Engine gameengine2 = Engine.EngineInstance(renderer, userInterface); // every next time EngineInstance is called it returns null Initialize(gameEngine); gameEngine.Run(); }
public string DisplayKeyboard(string keyText, string type) { _sKeyText = ""; var objKeyboard = new KeyboardInterface(); if (type == "Pwd") { objKeyboard.IsPwd = true; } objKeyboard.Closing += ObjKeyboardClosing; objKeyboard.KeyString = keyText; objKeyboard.Top = Top + Height - objKeyboard.Height; objKeyboard.Left = Left + Width / 2 - objKeyboard.Width / 2; objKeyboard.ShowDialog(); return(_sKeyText); }
static void Main() { IRenderer renderer = new ConsoleRenderer(WorldRows, WorldCols); IUserInterface keyboard = new KeyboardInterface(); Engine gameEngine = new Engine(renderer, keyboard); keyboard.OnLeftPressed += (sender, eventInfo) => gameEngine.MovePlayerRacketLeft(); keyboard.OnRightPressed += (sender, eventInfo) => gameEngine.MovePlayerRacketRight(); keyboard.OnActionPressed += (sender, eventInfo) => gameEngine.ShootPlayerRacket(); Initialize(gameEngine); gameEngine.Run(); }
private string DisplayKeyboard(string keyText, string type) { s_KeyText = ""; var objKeyboard = new KeyboardInterface(); if (type == "Pwd") { objKeyboard.IsPwd = true; } objKeyboard.Closing += ObjKeyboardClosing; objKeyboard.KeyString = keyText; Point locationFromScreen = this.PointToScreen(new Point(0, 0)); PresentationSource source = PresentationSource.FromVisual(this); System.Windows.Point targetPoints = source.CompositionTarget.TransformFromDevice.Transform(locationFromScreen); objKeyboard.Top = targetPoints.Y + this.Height / 2; objKeyboard.Left = targetPoints.X; objKeyboard.ShowDialog(); return(s_KeyText); }
public string DisplayKeyboard(string keyText) { strKeyText = ""; KeyboardInterface objKeyboard = null; try { Window w = Window.GetWindow(this); Point pt = default(Point); Size sz = default(Size); if (w != null) { pt = new Point(w.Left, w.Top); sz = new Size(w.Width, w.Height); } objKeyboard = new KeyboardInterface(); objKeyboard.Owner = w; objKeyboard.Closing += new System.ComponentModel.CancelEventHandler(objKeyboard_Closing); objKeyboard.KeyString = keyText; objKeyboard.Top = pt.Y + (sz.Height - objKeyboard.Height); objKeyboard.Left = pt.X + (sz.Width / 2) - (objKeyboard.Width / 2); objKeyboard.ShowInTaskbar = false; objKeyboard.ShowDialog(); if (objKeyboard != null) { objKeyboard.Closing -= this.objKeyboard_Closing; } } catch (Exception ex) { ExceptionManager.Publish(ex); } finally { } return(strKeyText); }
public string DisplayKeyboard(string keyText) { strKeyText = ""; KeyboardInterface objKeyboard = null; try { Window w = Window.GetWindow(this); Point pt = default(Point); Size sz = default(Size); if (w != null) { pt = new Point(w.Left, w.Top); sz = new Size(w.Width, w.Height); } objKeyboard = new KeyboardInterface(); objKeyboard.Owner = w; objKeyboard.Closing += new System.ComponentModel.CancelEventHandler(objKeyboard_Closing); objKeyboard.KeyString = keyText; objKeyboard.Top = pt.Y + (sz.Height - objKeyboard.Height); objKeyboard.Left = pt.X + (sz.Width / 2) - (objKeyboard.Width / 2); objKeyboard.ShowInTaskbar = false; objKeyboard.ShowDialog(); if (objKeyboard != null) { objKeyboard.Closing -= this.objKeyboard_Closing; } } catch (Exception ex) { ExceptionManager.Publish(ex); } finally { } return strKeyText; }
public CommonKeyboard(KeyboardInterface listener) : this() { this.listener = listener; }
public RuneScapeKeyboardService(IOptions <RuneScapeSettings> config) { _config = config.Value; _keyboard = new KeyboardInterface(_config.ProcessName); }
public ControlInterface(int playerNumber) { gamepadInterface = new GamepadInterface (playerNumber); keyboardInterface = new KeyboardInterface (playerNumber); }
private string DisplayKeyboard(string KeyText, string type) { try { LogManager.WriteLog("Inside DisplayKeyboard", LogManager.enumLogLevel.Info); strKeyText = ""; KeyboardInterface objKeyboard = new KeyboardInterface(); if (type == "Pwd") { objKeyboard.IsPwd = true; } objKeyboard.Closing += new System.ComponentModel.CancelEventHandler(objKeyboard_Closing); objKeyboard.KeyString = KeyText; Point locationFromScreen = this.PointToScreen(new Point(0, 0)); PresentationSource source = PresentationSource.FromVisual(this); System.Windows.Point targetPoints = source.CompositionTarget.TransformFromDevice.Transform(locationFromScreen); objKeyboard.Top = targetPoints.Y + this.Height / 2; objKeyboard.Left = targetPoints.X; objKeyboard.ShowDialogEx(this); return strKeyText; } catch (Exception ex) { ExceptionManager.Publish(ex); return string.Empty; } }
public string DisplayKeyboard(string keyText, string type) { _sKeyText = ""; using (var objKeyboard = new KeyboardInterface()) { objKeyboard.Closing += ObjKeyboardClosing; objKeyboard.KeyString = keyText; objKeyboard.WindowStartupLocation = WindowStartupLocation.CenterScreen; // objKeyboard.Owner = CprintprmTick; objKeyboard.ShowDialog(); } return _sKeyText; }
public string DisplayKeyboard(string keyText, string type) { _sKeyText = ""; var objKeyboard = new KeyboardInterface(); if (type == "Pwd") { objKeyboard.IsPwd = true; } objKeyboard.Closing += ObjKeyboardClosing; objKeyboard.KeyString = keyText; objKeyboard.Top = Top + Height - objKeyboard.Height; objKeyboard.Left = Left + Width / 2 - objKeyboard.Width / 2; objKeyboard.ShowDialogEx(this); return _sKeyText; }
private string DisplayKeyboard(string KeyText, string type) { strKeyText = ""; KeyboardInterface objKeyboard = new KeyboardInterface(); if (type == "Pwd") { objKeyboard.IsPwd = true; } objKeyboard.Closing += new System.ComponentModel.CancelEventHandler(objKeyboard_Closing); objKeyboard.KeyString = KeyText; Point locationFromScreen = this.PointToScreen(new Point(0, 0)); PresentationSource source = PresentationSource.FromVisual(this); System.Windows.Point targetPoints = source.CompositionTarget.TransformFromDevice.Transform(locationFromScreen); objKeyboard.Top = targetPoints.Y + this.Height / 2; objKeyboard.Left = targetPoints.X; objKeyboard.ShowDialog(); return strKeyText; }
private static void Main() { ConsoleSettings.PrepareConsole(); KeyboardInterface keyboard = new KeyboardInterface(); Opponent enemy = new Opponent(new MatrixCoords(3, 3), new char[, ] { { '@' } }, null); ConsoleRenderer renderer = new ConsoleRenderer(ConsoleSettings.ConsoleHeight, ConsoleSettings.ConsoleWidth); IList <WorldObject> map = MapParser.ParseMap("../../WorldMaps/map.txt"); GameEngine.GameEngine gameEngine = new GameEngine.GameEngine(renderer, keyboard); int heroChosen = 0; Console.WriteLine("Please select your Hero: \nPress 1 for Mage\nPress 2 for Thief\nPress 3 for Warrior"); // validates hero choice and let's player choose correctly do { try { heroChosen = int.Parse(Console.ReadLine()); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine("Please choose 1, 2 or 3"); } } while (!true || heroChosen < 1 || heroChosen > 3); Console.Clear(); // TODO implement interface for the choice of type of character MainCharacter hero = HeroChoice(heroChosen); hero.AddWeapon(new Knife("Steel knife") { MinDmg = 20, MaxDmg = 30 }); //hero.AddWeapon(new Knife("mnogo qk knife") { MaxDmg = 30, MinDmg = 20 }); gameEngine.AddObject(hero); gameEngine.AddObject(enemy); Opponent newOpponent = new Opponent(new MatrixCoords(2, 35), new char[, ] { { '@' } }, new BattleAxe("Battle Axe")); Opponent newOpponent2 = new Opponent(new MatrixCoords(7, 30), new char[, ] { { '@' } }, new Knife("Steel knife")); Opponent newOpponent3 = new Opponent(new MatrixCoords(10, 10), new char[, ] { { '@' } }, new BattleAxe("Battle Axe")); Opponent newOpponent4 = new Opponent(new MatrixCoords(15, 15), new char[, ] { { '@' } }, new BattleAxe("Battle Axe")); gameEngine.AddObject(newOpponent); gameEngine.AddObject(newOpponent2); gameEngine.AddObject(newOpponent3); gameEngine.AddObject(newOpponent4); foreach (var item in map) { gameEngine.AddObject(item); } keyboard.OnDownPressed += (sender, eventInfo) => { hero.Move(Direction.Down); }; keyboard.OnLeftPressed += (sender, eventInfo) => { hero.Move(Direction.Left); }; keyboard.OnRightPressed += (sender, eventInfo) => { hero.Move(Direction.Right); }; keyboard.OnUpPressed += (sender, eventInfo) => { hero.Move(Direction.Top); }; keyboard.onPotionPressed += (sencer, eventInfo) => { hero.Health += 5; }; gameEngine.Run(); }