Example #1
0
 protected void OnFocusEvent(FocusEventArgs?e)
 {
     if (OnFocus.HasDelegate)
     {
         OnFocus.InvokeAsync(e);
     }
 }
Example #2
0
 public void HandleFocus(string value)
 {
     if (OnFocus.HasDelegate)
     {
         OnFocus.InvokeAsync(value);
     }
 }
Example #3
0
        void OnWindowsEvent(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
        {
            if (eventType == WinEvent.EVENT_SYSTEM_MINIMIZEEND || eventType == WinEvent.EVENT_SYSTEM_FOREGROUND)
            {
                FocusedWindow = GetWindowTitle(hwnd);
                if (IsPathOfExileInFocus || IsSidekickInFocus)
                {
                    logger.LogInformation("Path of Exile focused.");
                    PathOfExileWasMinimized = false;
                    OnFocus?.Invoke();
                }
                else if (!PathOfExileWasMinimized)
                {
                    PathOfExileWasMinimized = true;
                    logger.LogInformation("Path of Exile minimized.");
                    OnBlur?.Invoke();
                }

                // If the game is run as administrator, Sidekick also needs administrator privileges.
                if (!PermissionChecked && IsPathOfExileInFocus)
                {
                    PermissionChecked = true;
                    Task.Run(async() =>
                    {
                        if (!IsUserRunAsAdmin() && IsPathOfExileRunAsAdmin())
                        {
                            await RestartAsAdmin();
                        }
                    });
                }
            }
        }
Example #4
0
 internal virtual async Task OnFocusAsync(FocusEventArgs e)
 {
     if (OnFocus.HasDelegate)
     {
         await OnFocus.InvokeAsync(e);
     }
 }
Example #5
0
 /// <summary>
 /// Assigns all events to the selectable, since there are so many of them.
 /// </summary>
 /// <param name="selectable">The selectable to assign events to.</param>
 /// <param name="i">The index of the methods array.</param>
 /// <param name="j">The number to pass into the method.</param>
 private void AssignSelectable(KMSelectable selectable, ref int i, ref int j)
 {
     if (OnCancel != null && i < OnCancel.Length)
     {
         selectable.OnCancel += OnCancel[i](j);
     }
     if (OnDefocus != null && i < OnDefocus.Length)
     {
         selectable.OnDefocus += OnDefocus[i](j);
     }
     if (OnDeselect != null && i < OnDeselect.Length)
     {
         selectable.OnDeselect += OnDeselect[i](j);
     }
     if (OnFocus != null && i < OnFocus.Length)
     {
         selectable.OnFocus += OnFocus[i](j);
     }
     if (OnHighlight != null && i < OnHighlight.Length)
     {
         selectable.OnHighlight += OnHighlight[i](j);
     }
     if (OnHighlightEnded != null && i < OnHighlightEnded.Length)
     {
         selectable.OnHighlightEnded += OnHighlightEnded[i](j);
     }
     if (OnInteract != null && i < OnInteract.Length)
     {
         selectable.OnInteract += OnInteract[i](j);
     }
     if (OnInteractEnded != null && i < OnInteractEnded.Length)
     {
         selectable.OnInteractEnded += OnInteractEnded[i](j);
     }
     if (OnLeft != null && i < OnLeft.Length)
     {
         selectable.OnLeft += OnLeft[i](j);
     }
     if (OnRight != null && i < OnRight.Length)
     {
         selectable.OnRight += OnRight[i](j);
     }
     if (OnSelect != null && i < OnSelect.Length)
     {
         selectable.OnSelect += OnSelect[i](j);
     }
 }
Example #6
0
 private void TextBoxAutoComplete_GotFocus(object sender, RoutedEventArgs e)
 {
     if (OnFocus != null && TextBoxAutoComplete.Text == "" && !IsMultiSelect)
     {
         ComboAutoComplete.IsDropDownOpen = true;
         OnFocus?.Invoke();
     }
 }
Example #7
0
 private void TextBoxAutoComplete_GotMouseCapture(object sender, MouseEventArgs e)
 {
     if (OnFocus != null && TextBoxAutoComplete.Text == "")
     {
         ComboAutoComplete.IsDropDownOpen = true;
         OnFocus?.Invoke();
     }
 }
Example #8
0
        private void TextChanged()
        {
            try
            {
                if (TextBoxAutoComplete.Text.Length > 0)
                {
                    TextBoxAutoComplete.SelectionStart  = TextBoxAutoComplete.Text.Length;
                    TextBoxAutoComplete.SelectionLength = 0;
                }
                ComboAutoComplete.Items.Clear();

                if (!IsMultiSelect)
                {
                    Selections.Clear();
                }

                var searchText = GetSearchText();

                if (TextBoxAutoComplete.Text.Length < _searchThreshold)
                {
                    ComboAutoComplete.IsDropDownOpen = false;
                    OnClear?.Invoke();
                    OnFocus?.Invoke();
                    return;
                }

                if (string.IsNullOrEmpty(searchText))
                {
                    return;
                }

                TextBoxAutoComplete.IsEnabled = false;

                if (OnSearch != null)
                {
                    if (ImgLoader != null)
                    {
                        ImgLoader.Visibility = Visibility.Visible;
                    }

                    var searchTask = Task.Run(() =>
                    {
                        OnSearch?.Invoke(searchText);
                    }, CancellationToken.None);

                    searchTask.ContinueWith((t) =>
                    {
                        TextBoxAutoComplete.IsEnabled = true; TextBoxAutoComplete.Focus();

                        Task.Delay(2000)
                        .ContinueWith((delayTask) => { ImgLoader.Visibility = Visibility.Collapsed; },
                                      TaskScheduler.FromCurrentSynchronizationContext());
                    }, TaskScheduler.FromCurrentSynchronizationContext());
                }
            }
            catch { }
        }
Example #9
0
 public void Focus()
 {
     if (!focused)
     {
         Main.clrInput();
         focused = true;
         OnFocus?.Invoke();
     }
 }
Example #10
0
 public FocusNode(
     string name,
     OnFocus onFocus,
     int count
     ) : base(name)
 {
     this.focusOn = onFocus;
     this.count   = count;
 }
Example #11
0
    public void OnDestroy()
    {
        if (OnFocus != null)
        {
            foreach (Delegate d in OnFocus.GetInvocationList())
            {
                OnFocus -= (Action <IDialog>)d;
            }
            OnFocus = null;
        }

        if (OnBlur != null)
        {
            foreach (Delegate d in OnBlur.GetInvocationList())
            {
                OnBlur -= (Action <IDialog>)d;
            }
            OnBlur = null;
        }

        if (OnShow != null)
        {
            foreach (Delegate d in OnShow.GetInvocationList())
            {
                OnShow -= (Action <IDialog>)d;
            }
            OnShow = null;
        }

        if (OnHide != null)
        {
            foreach (Delegate d in OnHide.GetInvocationList())
            {
                OnHide -= (Action <IDialog>)d;
            }
            OnHide = null;
        }

        if (OnClose != null)
        {
            foreach (Delegate d in OnClose.GetInvocationList())
            {
                OnClose -= (Action <IDialog>)d;
            }
            OnClose = null;
        }

        if (OnCancel != null)
        {
            foreach (Delegate d in OnCancel.GetInvocationList())
            {
                OnCancel -= (Action <IDialog>)d;
            }
            OnCancel = null;
        }
    }
Example #12
0
        internal void Focus()
        {
            if (!focused)
            {
                Main.clrInput();
                focused         = true;
                Main.blockInput = true;

                OnFocus?.Invoke();
            }
        }
Example #13
0
        public void Focus()
        {
            if (!focused)
            {
                Main.clrInput();
                focused         = true;
                Main.blockInput = true;
                cursorPos       = currentString.Length;

                OnFocus?.Invoke();
            }
        }
Example #14
0
 internal virtual async Task OnFocusAsync(FocusEventArgs e)
 {
     IsFocused = true;
     if (_hasAffixWrapper)
     {
         SetClasses();
     }
     if (OnFocus.HasDelegate)
     {
         await OnFocus.InvokeAsync(e);
     }
 }
Example #15
0
        private void OnInputFocus()
        {
            if (Value != null || Options != null && Options.Any())
            {
                ToggleState = true;
            }

            if (!string.IsNullOrWhiteSpace(Value))
            {
                OnFocus?.Invoke(Value);
            }
        }
Example #16
0
 private static void Update()
 {
     if (!_appFocused && UnityEditorInternal.InternalEditorUtility.isApplicationActive)
     {
         _appFocused = UnityEditorInternal.InternalEditorUtility.isApplicationActive;
         OnFocus?.Invoke(true);
     }
     else if (_appFocused && !UnityEditorInternal.InternalEditorUtility.isApplicationActive)
     {
         _appFocused = UnityEditorInternal.InternalEditorUtility.isApplicationActive;
         OnFocus?.Invoke(false);
     }
 }
Example #17
0
        public void Focus()
        {
            if (!focused)
            {
                focused         = true;
                Main.blockInput = true;
                Main.clrInput();

                OnFocus?.Invoke();

                counter = 0;
            }
        }
Example #18
0
        public void Focus()
        {
            if (!focused)
            {
                Main.clrInput();
                focused         = true;
                Main.blockInput = true;

                //OnFocus?.Invoke(); //###
                if (OnFocus != null)
                {
                    OnFocus.Invoke();
                }
            }
        }
Example #19
0
        public void Focus()
        {
            if (!Focused)
            {
                foreach (var o in Options)
                {
                    o.Left.Set(OptionsX, 0);
                }
                OnFocus?.Invoke();

                ScaleUpBasedOnHover = false;
                ScaledUp            = true;

                Focused = true;
            }
        }
        internal async void Onfocus(FocusEventArgs args)
        {
            if (args == null)
            {
                return;
            }

            Focused = true;
            if (OnFocus.HasDelegate)
            {
                await OnFocus.InvokeAsync(args);
            }

            await JsInvokeAsync(JSInteropConstants.focus, Ref);

            StateHasChanged();
        }
        public SearchTextBox()
        {
            InitializeComponent();
            this.DataContext = this;

            aControl.GotFocus          += (s, e) => OnFocus?.Invoke();
            this.MouseLeftButtonUp     += (s, e) => OnFocus?.Invoke();
            aControl.MouseLeftButtonUp += (s, e) => OnFocus?.Invoke();
            this.aControl.KeyUp        += (s, e) =>
            {
                if (e.Key == Key.Down)
                {
                    e.Handled = true;
                    OnFechaAbajo?.Invoke();
                }
            };
            //aControl.PreviewMouseDown += (s, e) => { if (aControl.IsFocused) OnFocus?.Invoke(); };
        }
Example #22
0
        private void FocusCamera()
        {
            //Get the center and radius of the selection bounding sphere
            Bounds  selectionBounds = ObjectSelection.Instance.SelectionBounds;
            Vector3 boundsCenter    = selectionBounds.center;
            float   boundsRadius    = selectionBounds.extents.magnitude;

            //Expand the radius to keep the camera further away from the selection
            boundsRadius *= focusDistMultiplier;

            //The normalized vector pointing towards the camera along the camera's line of sight
            Vector3 lookVector = (-transform.forward).normalized;

            //Translate the camera to the intersection point between the look vector and the expanded bounding sphere
            transform.position = boundsCenter + (lookVector * boundsRadius);

            //Notify all listeners that the camera was focused
            OnFocus?.Invoke();
        }
        public void Focus()
        {
            if (!Focused)
            {
                Main.clrInput();
                Main.blockInput = true;
                Focused         = true;

                if (Text == HintText)
                {
                    SetText("");
                }

                ScaleUpBasedOnHover = false;
                ScaledUp            = true;

                OnFocus?.Invoke();
            }
        }
        private async Task HasGotFocus()
        {
            ValueBeforeFocus = Value;
            ActiveClass      = ComputeClass();
            AdditionalStyles = "";

            decimal decValue = Convert.ToDecimal(Value);
            var     value    = decValue.ToString("G29", Culture.NumberFormat);
            await JsModule.InvokeVoidAsync("SetNumericTextBoxValue", new string[] { "#" + Id, value });

            if (decValue == 0)
            {
                await JsModule.InvokeVoidAsync("SelectNumericTextBoxContents", new string[] { "#" + Id, VisibleValue });
            }

            if (OnFocus != null)
            {
                await OnFocus.Invoke();
            }
        }
Example #25
0
 protected virtual Task HandleFocus(FocusEventArgs args)
 {
     return(OnFocus.InvokeAsync(args));
 }
Example #26
0
        bool IFocusable.Focus()
        {
            OnFocus?.Invoke(this);

            return(true);
        }
 private void OnPointerEnter()
 {
     OnFocus?.Invoke();
 }
 private async Task OnOptionFocus(FocusEventArgs focusEventArgs)
 {
     await OnFocus.InvokeAsync(new ChoiceGroupOptionFocusEventArgs { Item = Item, FocusEventArgs = focusEventArgs });
 }
Example #29
0
 private void Focus(FocusEventArgs e)
 {
     this._isFocused = true;
     OnFocus.InvokeAsync(e);
 }
Example #30
0
 public static void OnFocusHook()
 {
     OnFocus?.Invoke(null, EventArgs.Empty);
 }