Example #1
0
        public RokredTextBox()
        {
            InitializeComponent();

            //   CommandParameter = this;

            Observable.FromEventPattern <FocusEventArgs>(
                x => InvisibleEntry.Unfocused += x,
                x => InvisibleEntry.Unfocused -= x)
            .Where(e => e.EventArgs != null)
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(ev =>
            {
                LostFocusEvent?.Invoke(ev.Sender, ev.EventArgs);
            });

            Observable.FromEventPattern <TextChangedEventArgs>(
                x => InvisibleEntry.TextChanged += x,
                x => InvisibleEntry.TextChanged -= x)
            .Where(e => e.EventArgs != null)
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(ev =>
            {
                Text = InvisibleEntry.Text;
            });

            OnTextChanged(Text);
        }
Example #2
0
        /// <summary>
        /// Any update logic that should occur immediately before the main Update loop
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values</param>
        private void PreUpdate(GameTime gameTime)
        {
            //Tell if we change window focus state
            bool focused = IsActive;

            //Lost focus
            if (focused == false && WasFocused == true)
            {
                //Debug.LogError("LOST FOCUS");
                LostFocusEvent?.Invoke();
            }
            //Regained focus
            else if (focused == true && WasFocused == false)
            {
                //Debug.LogError("REGAINED FOCUS");
                RegainedFocusEvent?.Invoke();
            }

            //Set focus state
            WasFocused = focused;

            Time.UpdateTime(gameTime);
            Debug.DebugUpdate(battleManager);
        }