private void FocusSearchBox(object sender, HotkeyEventArgs e)
        {
            if (SearchResultsPopup.IsOpen)
            {
                EverythingSearch.Instance.SearchTerm = null;
            }
            else
            {
                SetForegroundWindow(((HwndSource)PresentationSource.FromVisual(this)).Handle);
                FocusRequested?.Invoke(this, new EventArgs());
                Keyboard.Focus(SearchBox);

                if (Properties.Settings.Default.isIconOnly)
                {
                    EverythingSearch.Instance.SearchTerm = "";
                }
            }
        }
Beispiel #2
0
        private void HandleIncomingMessage(IncomingMessage message)
        {
            if (message?.Type == null)
            {
                return;
            }
            switch (message.Type)
            {
            case "stage":
                if (message.End)
                {
                    Close();
                    return;
                }
                StageReceived?.Invoke(this, new MiStage
                {
                    StimId           = message.StimId,
                    VisualStimulus   = MiStage.Stimulus <MiStage.VisualStimulusType> .Parse(message.VisualResource),
                    AuditoryStimulus = MiStage.Stimulus <MiStage.AuditoryStimulusType> .Parse(message.AuditoryResource),
                    Duration         = (ulong)Math.Max(message.Duration, 0),
                    IsPreload        = message.Duration == -1,
                    ShowProgressBar  = message.ProgressBar,
                    DebugInfo        = message
                });
                break;

            case "progress":
                ProgressChanged?.Invoke(this, message.Progress);
                break;

            case "focus":
                FocusRequested?.Invoke(this, message.GazePosition);
                break;

            case "animation_ctrl":
                ControlCommandReceived?.Invoke(this, message.IsStopCtrl ? ControlCommand.Pause : ControlCommand.Play);
                break;

            default:
                Logger.Warn("HandleIncomingMessage - unsupported message", "type", message.Type);
                _notifier.ShowWarning($"Unsupported message type: {message.Type}");
                break;
            }
        }
 private void OnMouseDown(object sender, MouseButtonEventArgs e)
 {
     FocusRequested?.Invoke(this, new EventArgs());
 }
Beispiel #4
0
 protected virtual void OnFocusRequested(string propertyName)
 {
     FocusRequested?.Invoke(this, new FocusRequestedEventArgs(propertyName));
 }
Beispiel #5
0
 public void RequestFocus()
 {
     FocusRequested?.Invoke(this, EventArgs.Empty);
 }
 public static void SetFocusTo(FocusRequest req)
 {
     FocusRequested?.Invoke(req);
 }