当前位置: 首页>>代码示例>>C#>>正文


C# KeyHandler类代码示例

本文整理汇总了C#中KeyHandler的典型用法代码示例。如果您正苦于以下问题:C# KeyHandler类的具体用法?C# KeyHandler怎么用?C# KeyHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


KeyHandler类属于命名空间,在下文中一共展示了KeyHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            var keyHandler = new KeyHandler(this, DisplayControl);
            KeyDown += keyHandler.OnKeyDown;
        }
开发者ID:EdwardSalter,项目名称:NCubeSolver,代码行数:7,代码来源:MainWindow.xaml.cs

示例2: Daleks

 public Daleks() : super("Daleks") {
     setSize(1020, 820);
     setResizable(false);
     this.addWindowListener(new FrameListener());
     var menuBar = new MenuBar();
     this.setMenuBar(menuBar);
     var menu = new Menu("File");
     menuBar.add(menu);
     
     var menuItem = new MenuItem("New Game");
     menu.add(menuItem);
     menuItem.addActionListener(p => newGame());
     
     menuItem = new MenuItem("-");
     menu.add(menuItem);
     
     menuItem = new MenuItem("Exit");
     menu.add(menuItem);
     menuItem.addActionListener(p => dispose());
     
     this.setLayout(new BorderLayout());
     this.add(status = new Label("To start: File > New Game"), BorderLayout.SOUTH);
     this.keyHandler = new KeyHandler(this);
     this.addKeyListener(keyHandler);
     
     this.timer = new Timer(true);
 }
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:27,代码来源:Daleks.stab.cs

示例3: Run

        public void Run()
        {
            Log.InfoFormat("Starting timer with a sample rate of {0} ms", _sampleRateMilliseconds);
            var timer = new Timer();
            timer.AutoReset = true;
            timer.Interval = _sampleRateMilliseconds;
            timer.Elapsed += (s, e) => Tick();
            timer.Start();

            var keyHandler = new KeyHandler();
            keyHandler.WaitForExit();
        }
开发者ID:neutmute,项目名称:PiCamCV,代码行数:12,代码来源:TimerRunner.cs

示例4: Page_Loaded

        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            this.Focus();

            Page.Keyhandler = new KeyHandler();
            Page.Keyhandler.Attach(this);

            //Page.MouseHandler = new MouseHandler();
            //Page.MouseHandler.Attach(this);

            Page.SceneLoop = new SceneLoop();
            Page.SceneLoop.Attach(this.mainCanvas);

            view = new TankView();
            view.Ended += new EventHandler(view_Ended);

            this.mainCanvas.Children.Add(view);
        }
开发者ID:kindohm,项目名称:tanks,代码行数:18,代码来源:Page.xaml.cs

示例5: Page_Loaded

 public void Page_Loaded(object o, EventArgs e)
 {
     // Required to initialize variables
     _splash = new Splash();
     canvas.Children.Add(_splash);
     _splash.SetValue(Canvas.ZIndexProperty, 20000);
     KeyHandler = new KeyHandler();
     KeyHandler.Attach(this);
     Focus();
     gameLoop = new GameLoop();
     gameLoop.Attach(parentCanvas);
     gameLoop.Update += gameLoop_Update;
     Fps fps = new Fps();
     canvas.Children.Add(fps);
     fps.SetValue(Canvas.ZIndexProperty, 1000);
     _mainMenu = new MainMenu();
     canvas.Children.Add(_mainMenu);
     _mainMenu.MenuItemSelected += mainMenu_MenuItemSelected;
     Page_SizeChanged(null, null);
 }
开发者ID:rbrother,项目名称:seikkailulaakso,代码行数:20,代码来源:Page.xaml.cs

示例6: Handler

			public Handler (ConsoleKeyInfo cki, KeyHandler h, bool resetCompletion = true)
			{
				CKI = cki;
				KeyHandler = h;
				ResetCompletion = resetCompletion;
			}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:6,代码来源:getline.cs

示例7: CreateHook

        public static void CreateHook(KeyHandler _kh)
        {
            Process _this = Process.GetCurrentProcess();
            ProcessModule mod = _this.MainModule;
            hd = HookFunc;
            kh = _kh;

            hhk = API.SetWindowsHookEx(13, hd, API.GetModuleHandle(mod.ModuleName), 0);
            //13 is the parameter specifying that we're gonna do a low-level keyboard hook

            //MessageBox.Show(Marshal.GetLastWin32Error().ToString()); //for debugging
            //Note that this could be a Console.WriteLine(), as well. I just happened
            //to be debugging this in a Windows Application
            //to get the errors, in VS 2005+ (possibly before) do Tools -> Error Lookup
        }
开发者ID:parappayo,项目名称:Bushido-Burrito,代码行数:15,代码来源:KeybdHook.cs

示例8: EditLoop

		void EditLoop ()
		{
			ConsoleKeyInfo cki;

			while (!done){
				cki = Console.ReadKey (true);

				bool handled = false;
				foreach (Handler handler in handlers){
					ConsoleKeyInfo t = handler.CKI;

					if (t.Key == cki.Key && t.Modifiers == cki.Modifiers){
						handled = true;
						handler.KeyHandler ();
						last_handler = handler.KeyHandler;
						break;
					} else if (t.KeyChar == cki.KeyChar && t.Key == ConsoleKey.Zoom){
						handled = true;
						handler.KeyHandler ();
						last_handler = handler.KeyHandler;
						break;
					}
				}
				if (handled){
					if (searching != 0){
						if (last_handler != CmdReverseSearch){
							searching = 0;
							SetPrompt (prompt);
						}
					}
					continue;
				}

				if (cki.KeyChar != (char) 0)
					HandleChar (cki.KeyChar);
			} 
		}
开发者ID:apenwarr,项目名称:versaplex,代码行数:37,代码来源:mono-getline.cs

示例9: Control

			public static Handler Control (char c, KeyHandler h)
			{
				return new Handler ((char) (c - 'A' + 1), h);
			}
开发者ID:apenwarr,项目名称:versaplex,代码行数:4,代码来源:mono-getline.cs

示例10: Handler

			public Handler (char c, KeyHandler h)
			{
				KeyHandler = h;
				// Use the "Zoom" as a flag that we only have a character.
				CKI = new ConsoleKeyInfo (c, ConsoleKey.Zoom, false, false, false);
			}
开发者ID:apenwarr,项目名称:versaplex,代码行数:6,代码来源:mono-getline.cs

示例11: Unmap

        /// <summary>
        /// Unmaps a key
        /// </summary>
        /// <param name="keyCombination">The combo</param>
        /// <param name="keyHandler">The handler</param>
        public KeyboardMapper Unmap(KeyCombination keyCombination, KeyHandler keyHandler)
        {
            #if DEBUG
            if (DebugMode)
                Debug.Log("KeyboardMapper.Unmap: " + keyCombination);
            #endif

            if (_mappings.ContainsKey(keyCombination))
            {
                _mappings[keyCombination].Remove(keyHandler);

                if (_mappings[keyCombination].Count == 0)
                    _mappings.Remove(keyCombination);
            }

            if (_oneShotMappings.ContainsKey(keyCombination))
            {
                _oneShotMappings[keyCombination].Remove(keyHandler);

                if (_oneShotMappings[keyCombination].Count == 0)
                    _oneShotMappings.Remove(keyCombination);
            }

            return this;
        }
开发者ID:BiDuc,项目名称:eDriven,代码行数:30,代码来源:KeyboardMapper.cs

示例12: Handler

			public Handler(ConsoleKeyInfo myConsoleKeyInfo, KeyHandler myKeyHandler)
			{
				CKI        = myConsoleKeyInfo;
				KeyHandler = myKeyHandler;
			}
开发者ID:nareenb,项目名称:CanonDSLR.NET,代码行数:5,代码来源:getline.cs

示例13: Form1_Load

 private void Form1_Load(object sender, EventArgs e)
 {
     KeyHandler ghk;
     ghk = new KeyHandler(Keys.F1, this);
     ghk.Register();
 }
开发者ID:Rasmus239,项目名称:evilgeddon-trainer,代码行数:6,代码来源:Form1.cs

示例14: EditLoop

        private void EditLoop()
        {
            ConsoleKeyInfo cki;

            while (!done) {
                ConsoleModifiers mod;

                cki = Console.ReadKey(true);
                if (cki.Key == ConsoleKey.Escape) {
                    cki = Console.ReadKey(true);

                    mod = ConsoleModifiers.Alt;
                } else
                    mod = cki.Modifiers;

                var handled = false;

                foreach (var handler in handlers) {
                    var t = handler.CKI;

                    if (t.Key == cki.Key && t.Modifiers == mod) {
                        handled = true;
                        handler.KeyHandler();
                        last_handler = handler.KeyHandler;
                        break;
                    }
                    if (t.KeyChar == cki.KeyChar && t.Key == ConsoleKey.Zoom) {
                        handled = true;
                        handler.KeyHandler();
                        last_handler = handler.KeyHandler;
                        break;
                    }
                }
                if (handled) {
                    if (searching != 0) {
                        if (last_handler != CmdReverseSearch) {
                            searching = 0;
                            SetPrompt(Prompt);
                        }
                    }
                    continue;
                }

                if (cki.KeyChar != (char) 0)
                    HandleChar(cki.KeyChar);
            }
        }
开发者ID:brian-brazil,项目名称:flabbergast,代码行数:47,代码来源:getline.cs

示例15: Control

			public static Handler Control (char c, KeyHandler h, bool resetCompletion = true)
			{
				return new Handler ((char) (c - 'A' + 1), h, resetCompletion);
			}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:4,代码来源:getline.cs


注:本文中的KeyHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。