/// <summary> /// Overridden. Starts to create the requested object, /// either immediately or on a background thread, /// based on the value of the IsAsynchronous property. /// </summary> protected override void BeginQuery() { if (this._init) { return; } if (this._firstRun) { this._firstRun = false; if (!IsInitialLoadEnabled) { return; } } if (this._endInitError) { // this handles a case where the WPF form initilizer // invokes the data provider twice when an exception // occurs - we really don't want to try the query twice // or report the error twice this._endInitError = false; this.OnQueryFinished(null, null, null, null); return; } if (this.IsRefreshDeferred) { return; } var request = new QueryRequest() { DataProducer = this.DataProducer, Version = this._queryVersion }; this.IsBusy = true; AsyncHelper.Invoke(() => DoQuery(request)); }
private void Button1_Click(object sender, EventArgs e) { AsyncHelper.Invoke <bool>(PerformOperation); }