public SelectEventDialog(MainForm mainForm, TrackerContext context)
        {
            this.InitializeComponent();

            this.MainForm = mainForm;

            this.ListBinding = new ListBinding<JObjectSimpleDisplay>(this.EventsList, x => new JObjectSimpleDisplay(x as JObject, "name"), "Display");
            this.ListBinding.AddSelectionControl(this.SelectButton);

            this.Context = context;

            this.CurrentSearch = this.Context.DeferredSearch("event", new Dictionary<string, string> { { "q", "" } });

            this.CurrentSearch.OnComplete += results =>
            {
                this.ListBinding.LoadArray(results);
                this.ListBinding.EnableControls();
            };

            this.ListBinding.DisableControls();
            this.CurrentSearch.Begin();
        }
예제 #2
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            if (this.Context == null)
                throw new Exception("Error, no TrackerContext was set.");

            this.AbortExistingSearch();

            this.CurrentSearch = this.Context.DeferredSearch(this.Model.ModelName, this.GetSearchParams());

            this.CurrentSearch.OnComplete += results =>
            {
                this.ListBinding.LoadArray(results);
                this.FormBinding.EnableControls();
                this.ListBinding.EnableControls();
            };

            this.FormBinding.DisableControls();
            this.ListBinding.DisableControls();
            this.CurrentSearch.Begin();
        }
예제 #3
0
        private void BasicSearchButton_Click(object sender, EventArgs e)
        {
            this.AbortExistingSearch();

            this.CurrentSearch = this.Context.DeferredSearch(this.Model.ModelName, new Dictionary<string, string> { { "q", BasicSearchText.Text } });

            this.CurrentSearch.OnComplete += results =>
            {
                this.ListBinding.LoadArray(results);
                this.FormBinding.EnableControls();
                this.ListBinding.EnableControls();
            };

            this.FormBinding.DisableControls();
            this.ListBinding.DisableControls();
            this.CurrentSearch.Begin();
        }
        public void RequestRefresh(EntitySelectionCacheRefreshType refreshType = EntitySelectionCacheRefreshType.Light)
        {
            if (!this.BlockRequests)
            {
                try
                {
                    this.AccessControl.WaitOne();

                    TimeSpan offset = this.GetSuggesstionOffset(refreshType);

                    if (!this.BlockRequests && this.LastRefreshTime.Add(offset) < DateTime.Now && (this.Searcher == null || !this.Searcher.Busy))
                    {
                        this.Searcher = new SearchContext(this.Context, this.ModelName, new Dictionary<string, string>());
                        this.Searcher.OnComplete += this.RefreshCache;
                        this.Searcher.Begin();
                    }
                }
                finally
                {
                    this.AccessControl.ReleaseMutex();
                }
            }
        }