2013-08-05 97 views
0

即时通讯工作在一个简单的控制台应用程序,只是在屏幕上显示的东西。无法访问System.Windows.Input下的键盘类

我进入System.Windows.Input类的问题,我只是不能得到他们。

这里的代码我尝试:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows.Input; 

namespace FUAndLOLInstall.LookForAndActivateFile 
{ 
    class KeyboardHandler 
    { 
     public void usKeyboard() 
     { 
      System.Windows.Input.Keyboard //its like the class Keyboard not exsit. 
     } 
    } 
} 

一些信息:使用librery TestStack.White做一些minpultion上windowm,我从我的应用程序启动 IM。

TestStack.White本身有一个键盘类(White.Core.InputDevices.Keyboard),但是这个类可以阻止我认识System.Windows.Input.Keyboard类吗?

+0

您正在使用完整路径,因此两个键盘类之间不会发生命名空间冲突。你可以用你的使用语句编辑吗?您可能会错过参考。 – evanmcdonnal

+0

也许一个愚蠢的问题,但你已经引用了PresentationCore.dll,对吧? –

+0

@Mario nope,我什至不知道该DLL。 – samy

回答

7

由于这是一个控制台应用程序,您需要添加对PresentationCore.dll的引用。在控制台应用程序中,此程序集将不会被默认引用。

您可以在文档中看到这样的Keyboard

命名空间:System.Windows.Input

大会:PresentationCore(在PresentationCore.dll中)

这是一个主要的WPF程序集,并默认包含在WPF项目中,但不包含控制台应用程序。

+0

是的,它做到了。谢谢! – samy

+0

等待7分钟以接受你的答案 – samy