コード例 #1
0
        public MainWindow(Assistant assistant, UserManager userManager, Settings settings, DeviceRegistration deviceRegistration)
        {
            InitializeComponent();

            _audioOut = new AudioOut();

            _hook          = new KeyboardHook();
            _hook.KeyDown += OnHookKeyDown;
            void OnHookKeyDown(object sender, HookEventArgs e)
            {
                // Global keyboard hook for Ctrl+Alt+G to start listening.
                if (e.Control && e.Alt && e.Key == Keys.G)
                {
                    StartListening();
                }
            }

            // When minimized it will hide in the tray. but the global keyboard hook should still work
            _notifyIcon              = new NotifyIcon();
            _notifyIcon.Icon         = ReadIcon("mic.ico");
            _notifyIcon.Text         = Title;
            _notifyIcon.DoubleClick +=
                delegate
            {
                _notifyIcon.Visible = false;
                Show();
                WindowState = WindowState.Normal;
            };

            this._assistant = assistant;
            this._assistant.OnAssistantStateChanged += OnAssistantStateChanged;
            this._assistant.OnAssistantDialogResult += OnAssistantDialogResult;
            this._assistant.OnAssistantSpeechResult += OnAssistantSpeechResult;

            this._userManager = userManager;
            this._userManager.OnUserUpdate += OnUserUpdate;

            this.deviceRegistration = deviceRegistration;

            this.settings = settings;

            dialogResults         = new ObservableCollection <DialogResult>();
            DialogBox.ItemsSource = dialogResults;
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: Aggror/IntelAct
        public MainWindow()
        {
            InitializeComponent();

            _audioOut = new AudioOut();

            _hook          = new KeyboardHook();
            _hook.KeyDown += OnHookKeyDown;
            void OnHookKeyDown(object sender, HookEventArgs e)
            {
                // Global keyboard hook for Ctrl+Alt+G to start listening.
                if (e.Control && e.Alt && e.Key == Keys.G)
                {
                    StartListening();
                }
            }

            // When minimized it will hide in the tray. but the global keyboard hook should still work
            _notifyIcon              = new NotifyIcon();
            _notifyIcon.Icon         = new System.Drawing.Icon("Mic.ico");
            _notifyIcon.Text         = Title;
            _notifyIcon.DoubleClick +=
                delegate
            {
                _notifyIcon.Visible = false;
                Show();
                WindowState = WindowState.Normal;
            };

            _assistant          = new Assistant();
            _assistant.OnDebug += Output;
            _assistant.OnAssistantStateChanged += OnAssistantStateChanged;

            _userManager = UserManager.Instance;
            _userManager.OnUserUpdate += OnUserUpdate;

            IntelActPopup.Visibility = Visibility.Hidden;
            PassedResults.Visibility = Visibility.Hidden;
        }