public bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e)
        {
            var notify = (NotifyCollectionChangedEventArgs)e;

            UIHelper.BeginInvoke(delegate
            {
                ImageButtonExt.SetIsLoading(this, false);
                if (notify.Action == NotifyCollectionChangedAction.Reset)
                {
                    ItemsSource = null;
                }
                else
                {
                    var selectedItem = SelectedItem;
                    //ItemsSource = cache.Items.Values.ToList();
                    ItemsSource = cache.Items.Values.Where(FilterCollection).ToList();
                    EnsureSorting();
                    if (selectedItem != null)
                    {
                        SelectedItem = null;
                        SelectedItem = cache.GetItem(((BAGlobalObject)selectedItem).GlobalId);
                    }
                }
            }, Dispatcher);

            return(true);
        }
        void CachedFilteredComboBox_DropDownOpened(object sender, EventArgs e)
        {
            if (queryingPopup || (cache != null && cache.IsLoaded))
            {
                queryingPopup = false;
                ImageButtonExt.SetIsLoading(this, false);
                return;
            }


            queryingPopup = true;

            //cache = null;
            //loaded = false;
            //Console.WriteLine(cache!=null);
            //Console.WriteLine(loaded);
            ensureCache();
            ImageButtonExt.SetIsLoading(this, !cache.IsLoaded);
            MainWindow.Instance.RunAsynchronousOperation(delegate
            {
                cache.EnsureLoaded();
                //IsDropDownOpen = true;
                //IsEnabled = true;
                //Dispatcher.BeginInvoke(new Action(delegate
                //{
                //var selectedId = SelectedValue;
                //ItemsSource = cache.Items.Select(x => x.Value);
                //SelectedValue = selectedId;
                //loaded = true;
                //IsEnabled = true;
                //IsDropDownOpen = true;

                //}));
            });
            //ImageButtonExt.SetIsLoading(this, !cache.IsLoaded);
        }