Пример #1
0
        private void FocusTextBox(TextBox textBox)
        {
            DeferredAction deferredAction = null;

            deferredAction = DeferredAction.Create(() =>
            {
                if (textBox == null || App.Current == null || App.Current.MainWindow == null)
                {
                    return;
                }

                textBox.Focus();
                textBox.SelectAll();
                FocusManager.SetFocusedElement(App.Current.MainWindow, textBox);
                Keyboard.Focus(textBox);

                if (textBox.IsVisible == false || textBox.IsKeyboardFocused)
                {
                    deferredAction.Dispose();
                }
                else
                {
                    deferredAction.Defer(TimeSpan.FromSeconds(0.25));
                }
            });

            deferredAction.Defer(TimeSpan.FromSeconds(0.25));
        }
        public QuickMethodToolWindowControl(QuickMethodToolWindow oParent, bool searchInSolution, SymbolData.ESymbolType supportedSymbolTypes)
        {
            this.InitializeComponent();

            mQuickMethodToolWindow = oParent;

            mSearchInSolution = searchInSolution;
            mSupportedSymbolTypes = supportedSymbolTypes;

            mDeferredRefresh = DeferredAction.Create(RefreshResults);
            mDeferredRefresh.Defer(0);

            DataContext = this;

            textBox.Focus();

            // An aggregate catalog that combines multiple catalogs
            /*
            var catalog = new AggregateCatalog();

            // Adds all the parts found in the necessary assemblies
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(IGlyphService).Assembly));
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(SmartTagSurface).Assembly));

            // Create the CompositionContainer with the parts in the catalog
            CompositionContainer mefContainer = new CompositionContainer(catalog);

            // Fill the imports of this object
            mefContainer.ComposeParts(this);

            [Import]
            public IGlyphService GlyphService { get; set; }
            */
        }
Пример #3
0
        /// <summary>
        /// Change the search filter when the user stops typing
        /// </summary>
        /// <param name="property"></param>
        internal void ChangeFilterPending(string property)
        {
            if (_deferredAction == null)
            {
                _deferredAction = DeferredAction.Create(ExecuteFilter);
            }

            _deferredAction.Defer(TimeSpan.FromMilliseconds(250));
        }
Пример #4
0
        void CheckAndUnrevealDeferred()
        {
            IsBoardBlocked = true;
            DeferredAction doDeferred = new DeferredAction(() =>
            {
                bool doMatch = Game.CheckIfCardsMatchAndDiscard();
                if (!doMatch)
                {
                    Game.PlayerHandler.CurrentPlayer.IncreaseMissedCount();
                    Game.PlayerHandler.NextTurn();
                }
                Game.CheckIfGameIsOver();
                Game.Board.UnrevealCards();
                IsBoardBlocked = false;
            },
                                                           App.Current.Dispatcher);

            doDeferred.Defer(GlobalParameter.UnrevealTimeSpan);
        }
Пример #5
0
        private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "Message":
                OnPropertyChanged("StatusString");     // keep the counter updated
                break;

            case "SearchSettings":
            {
                if (!SearchSettings.IsChangingSettings)
                {
                    updateSearch.Defer(Constants.SearchDebounce);
                }
                break;
            }

            case "IsSearching":
            {
                messageManager.IsFiltering = isSearching;
                break;
            }
            }
        }
 public void RefreshContent()
 {
     mSymbols = null;
     mDeferredRefresh.Defer(0);
 }
Пример #7
0
 private void OnSearchSettingsUpdated(object sender, EventArgs e)
 {
     OnPropertyChanged("SearchSettings");
     OnPropertyChanged("GenderSettings");
     updateLists.Defer(Constants.SearchDebounce);
 }
Пример #8
0
 public static IDisposable DeferSave()
 {
     return(DeferredSave.Defer());
 }
Пример #9
0
 public void RefreshContent()
 {
     mDeferredRefresh.Defer(0);
 }
Пример #10
0
 private void SaveSearchTerms()
 {
     saveTerms.Defer(TimeSpan.FromSeconds(3));
 }
Пример #11
0
 private void UpdateAvailableViews()
 {
     updateActiveViews.Defer(Constants.SearchDebounce);
 }
Пример #12
0
 private void SearchTextbox_OnTextChanged(object _sender, TextChangedEventArgs _e)
 {
     m_deferredAction.Defer(m_delay);
 }