private void FocusGot() { if (ReadOnly) { return; } if (!HasFocus) { textBeforeCommit = Box.Text; if (ResetTextOnEdit) { Box.Text = string.Empty; } HasFocus = true; Box.BorderColour = BorderFocused; Box.BackgroundColour = backgroundFocused; //set text to current content. InputControl.Text = Box.Text; InputControl.AcceptText = true; //chatWasVisible = ChatEngine.IsVisible; cursor.Transformations.Clear(); cursor.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0.4F, GameBase.Time, GameBase.Time + 1000) { Easing = EasingTypes.Out, Loop = true }); selectionStartLast = -1; //Moved before UpdateCursorPosition to fix cursor mispositioning. Hopefully won't cause any side-effects. OnGotFocus?.Invoke(this, false); UpdateCursorPosition(); updateDisplay(); } }
public ViewModel() { OnGotFocus.Subscribe(() => { model.UpdateAppList(); }).AddTo(disposables); OnTopChecked.Subscribe(n => { if (Selected.Value != null) { Selected.Value.WindowState = WindowState.Top; } }).AddTo(disposables); OnNormalChecked.Subscribe(n => { if (Selected.Value != null) { Selected.Value.WindowState = WindowState.Normal; } }).AddTo(disposables); model.AddTo(disposables); }
private void TextBox_GotFocus(object sender, RoutedEventArgs e) { OnGotFocus?.Invoke(this, e); }