Index: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/OKBExperiment.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/OKBExperiment.cs	(revision 5304)
+++ branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/OKBExperiment.cs	(revision 5317)
@@ -337,6 +337,4 @@
     }
     private void algorithm_Stopped(object sender, EventArgs e) {
-      OnStopped();
-
       try {
         OKBClient.Instance.AddRun(AlgorithmId, ProblemId, algorithm);
@@ -345,4 +343,5 @@
         OnExceptionOccurred(ex);
       }
+      OnStopped();
     }
     private void algorithm_Runs_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<IRun> e) {
Index: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.Designer.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.Designer.cs	(revision 5304)
+++ branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.Designer.cs	(revision 5317)
@@ -46,5 +46,4 @@
     private void InitializeComponent() {
       this.components = new System.ComponentModel.Container();
-      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(QueryView));
       this.refreshResultsButton = new System.Windows.Forms.Button();
       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
@@ -55,4 +54,10 @@
       this.resultsGroupBox = new System.Windows.Forms.GroupBox();
       this.deserializeBlobsCheckBox = new System.Windows.Forms.CheckBox();
+      this.resultsInfoPanel = new System.Windows.Forms.Panel();
+      this.abortButton = new System.Windows.Forms.Button();
+      this.resultsProgressBar = new System.Windows.Forms.ProgressBar();
+      this.resultsInfoLabel = new System.Windows.Forms.Label();
+      this.filtersInfoPanel = new System.Windows.Forms.Panel();
+      this.filtersInfoLabel = new System.Windows.Forms.Label();
       ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
       this.splitContainer.Panel1.SuspendLayout();
@@ -61,4 +66,6 @@
       this.filtersGroupBox.SuspendLayout();
       this.resultsGroupBox.SuspendLayout();
+      this.resultsInfoPanel.SuspendLayout();
+      this.filtersInfoPanel.SuspendLayout();
       this.SuspendLayout();
       // 
@@ -84,5 +91,5 @@
       this.runCollectionView.Name = "runCollectionView";
       this.runCollectionView.ReadOnly = false;
-      this.runCollectionView.Size = new System.Drawing.Size(722, 156);
+      this.runCollectionView.Size = new System.Drawing.Size(826, 223);
       this.runCollectionView.TabIndex = 2;
       // 
@@ -103,6 +110,6 @@
       // 
       this.splitContainer.Panel2.Controls.Add(this.resultsGroupBox);
-      this.splitContainer.Size = new System.Drawing.Size(734, 435);
-      this.splitContainer.SplitterDistance = 217;
+      this.splitContainer.Size = new System.Drawing.Size(838, 567);
+      this.splitContainer.SplitterDistance = 282;
       this.splitContainer.TabIndex = 0;
       // 
@@ -115,5 +122,5 @@
       this.filtersGroupBox.Location = new System.Drawing.Point(0, 0);
       this.filtersGroupBox.Name = "filtersGroupBox";
-      this.filtersGroupBox.Size = new System.Drawing.Size(734, 214);
+      this.filtersGroupBox.Size = new System.Drawing.Size(838, 279);
       this.filtersGroupBox.TabIndex = 0;
       this.filtersGroupBox.TabStop = false;
@@ -127,5 +134,5 @@
       this.filterPanel.Location = new System.Drawing.Point(6, 19);
       this.filterPanel.Name = "filterPanel";
-      this.filterPanel.Size = new System.Drawing.Size(722, 189);
+      this.filterPanel.Size = new System.Drawing.Size(826, 254);
       this.filterPanel.TabIndex = 0;
       // 
@@ -140,5 +147,5 @@
       this.resultsGroupBox.Location = new System.Drawing.Point(0, 3);
       this.resultsGroupBox.Name = "resultsGroupBox";
-      this.resultsGroupBox.Size = new System.Drawing.Size(734, 211);
+      this.resultsGroupBox.Size = new System.Drawing.Size(838, 278);
       this.resultsGroupBox.TabIndex = 0;
       this.resultsGroupBox.TabStop = false;
@@ -153,15 +160,86 @@
       this.deserializeBlobsCheckBox.Name = "deserializeBlobsCheckBox";
       this.deserializeBlobsCheckBox.Size = new System.Drawing.Size(106, 17);
-      this.deserializeBlobsCheckBox.TabIndex = 3;
+      this.deserializeBlobsCheckBox.TabIndex = 1;
       this.deserializeBlobsCheckBox.Text = "&Deserialize Blobs";
       this.deserializeBlobsCheckBox.UseVisualStyleBackColor = true;
       // 
+      // resultsInfoPanel
+      // 
+      this.resultsInfoPanel.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
+      this.resultsInfoPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+      this.resultsInfoPanel.Controls.Add(this.abortButton);
+      this.resultsInfoPanel.Controls.Add(this.resultsProgressBar);
+      this.resultsInfoPanel.Controls.Add(this.resultsInfoLabel);
+      this.resultsInfoPanel.Location = new System.Drawing.Point(238, 339);
+      this.resultsInfoPanel.Name = "resultsInfoPanel";
+      this.resultsInfoPanel.Size = new System.Drawing.Size(362, 87);
+      this.resultsInfoPanel.TabIndex = 1;
+      this.resultsInfoPanel.Visible = false;
+      // 
+      // abortButton
+      // 
+      this.abortButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
+      this.abortButton.Location = new System.Drawing.Point(3, 58);
+      this.abortButton.Name = "abortButton";
+      this.abortButton.Size = new System.Drawing.Size(354, 23);
+      this.abortButton.TabIndex = 2;
+      this.abortButton.Text = "&Abort";
+      this.abortButton.UseVisualStyleBackColor = true;
+      this.abortButton.Click += new System.EventHandler(this.abortButton_Click);
+      // 
+      // resultsProgressBar
+      // 
+      this.resultsProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
+      this.resultsProgressBar.Enabled = false;
+      this.resultsProgressBar.Location = new System.Drawing.Point(3, 29);
+      this.resultsProgressBar.Name = "resultsProgressBar";
+      this.resultsProgressBar.Size = new System.Drawing.Size(354, 23);
+      this.resultsProgressBar.Step = 1;
+      this.resultsProgressBar.TabIndex = 1;
+      // 
+      // resultsInfoLabel
+      // 
+      this.resultsInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
+      this.resultsInfoLabel.Enabled = false;
+      this.resultsInfoLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.resultsInfoLabel.Location = new System.Drawing.Point(3, 3);
+      this.resultsInfoLabel.Name = "resultsInfoLabel";
+      this.resultsInfoLabel.Size = new System.Drawing.Size(354, 23);
+      this.resultsInfoLabel.TabIndex = 0;
+      this.resultsInfoLabel.Text = "Loading ...";
+      this.resultsInfoLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+      // 
+      // filtersInfoPanel
+      // 
+      this.filtersInfoPanel.Anchor = System.Windows.Forms.AnchorStyles.Top;
+      this.filtersInfoPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+      this.filtersInfoPanel.Controls.Add(this.filtersInfoLabel);
+      this.filtersInfoPanel.Enabled = false;
+      this.filtersInfoPanel.Location = new System.Drawing.Point(238, 136);
+      this.filtersInfoPanel.Name = "filtersInfoPanel";
+      this.filtersInfoPanel.Size = new System.Drawing.Size(362, 33);
+      this.filtersInfoPanel.TabIndex = 0;
+      this.filtersInfoPanel.Visible = false;
+      // 
+      // filtersInfoLabel
+      // 
+      this.filtersInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
+      this.filtersInfoLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.filtersInfoLabel.Location = new System.Drawing.Point(3, 4);
+      this.filtersInfoLabel.Name = "filtersInfoLabel";
+      this.filtersInfoLabel.Size = new System.Drawing.Size(354, 23);
+      this.filtersInfoLabel.TabIndex = 0;
+      this.filtersInfoLabel.Text = "Loading Filters ...";
+      this.filtersInfoLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+      // 
       // QueryView
       // 
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.filtersInfoPanel);
+      this.Controls.Add(this.resultsInfoPanel);
       this.Controls.Add(this.splitContainer);
       this.Name = "QueryView";
-      this.Size = new System.Drawing.Size(734, 435);
+      this.Size = new System.Drawing.Size(838, 567);
       this.splitContainer.Panel1.ResumeLayout(false);
       this.splitContainer.Panel2.ResumeLayout(false);
@@ -171,4 +249,6 @@
       this.resultsGroupBox.ResumeLayout(false);
       this.resultsGroupBox.PerformLayout();
+      this.resultsInfoPanel.ResumeLayout(false);
+      this.filtersInfoPanel.ResumeLayout(false);
       this.ResumeLayout(false);
 
@@ -185,4 +265,10 @@
     private System.Windows.Forms.Panel filterPanel;
     private System.Windows.Forms.CheckBox deserializeBlobsCheckBox;
+    private System.Windows.Forms.Panel resultsInfoPanel;
+    private System.Windows.Forms.ProgressBar resultsProgressBar;
+    private System.Windows.Forms.Label resultsInfoLabel;
+    private System.Windows.Forms.Button abortButton;
+    private System.Windows.Forms.Panel filtersInfoPanel;
+    private System.Windows.Forms.Label filtersInfoLabel;
 
   }
Index: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.cs	(revision 5304)
+++ branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.cs	(revision 5317)
@@ -21,7 +21,8 @@
 
 using System;
-using System.Collections.Generic;
 using System.IO;
 using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
 using System.Windows.Forms;
 using HeuristicLab.Core;
@@ -36,4 +37,5 @@
   [Content(typeof(OKBClient), false)]
   public sealed partial class QueryView : HeuristicLab.MainForm.WindowsForms.View {
+    private CancellationTokenSource cancellationTokenSource;
     private CombinedFilterView combinedFilterView;
 
@@ -44,28 +46,7 @@
     protected override void OnInitialized(EventArgs e) {
       base.OnInitialized(e);
-      this.Cursor = Cursors.AppStarting;
-
-      Func<CombinedFilter> func = () => {
-        return OKBClient.Instance.GetFilters().OfType<CombinedFilter>().Where(x => x.Operation == BooleanOperation.And).FirstOrDefault();
-      };
-
-      func.BeginInvoke((IAsyncResult result) => {
-        CombinedFilter filter = func.EndInvoke(result);
-        if (InvokeRequired) Invoke(new Action<CombinedFilter>(FinishedLoadingFilter), filter);
-        else FinishedLoadingFilter(filter);
-      }, null);
+      LoadFiltersAsync();
     }
 
-    private void FinishedLoadingFilter(CombinedFilter filter) {
-      if (filter != null) {
-        combinedFilterView = (CombinedFilterView)MainFormManager.CreateView(typeof(CombinedFilterView));
-        combinedFilterView.Content = (CombinedFilter)filter.Clone();
-        Control control = (Control)combinedFilterView;
-        control.Dock = DockStyle.Fill;
-        filterPanel.Controls.Add(control);
-      }
-      this.Cursor = Cursors.Default;
-      SetEnabledStateOfControls();
-    }
 
     protected override void SetEnabledStateOfControls() {
@@ -74,40 +55,91 @@
     }
 
-    private void refreshResultsButton_Click(object sender, EventArgs e) {
+    #region Load Filters
+    private void LoadFiltersAsync() {
+      Cursor = Cursors.AppStarting;
+      filtersInfoPanel.Visible = true;
+      splitContainer.Enabled = false;
+
+      Task<CombinedFilter> task = Task.Factory.StartNew<CombinedFilter>(() => {
+        return OKBClient.Instance.GetFilters().OfType<CombinedFilter>().Where(x => x.Operation == BooleanOperation.And).FirstOrDefault();
+      });
+      task.ContinueWith(t => {
+        CombinedFilter filter = t.Result;
+        Invoke(new Action(() => {
+          if (filter != null) {
+            combinedFilterView = (CombinedFilterView)MainFormManager.CreateView(typeof(CombinedFilterView));
+            combinedFilterView.Content = (CombinedFilter)filter.Clone();
+            Control control = (Control)combinedFilterView;
+            control.Dock = DockStyle.Fill;
+            filterPanel.Controls.Add(control);
+          }
+          filtersInfoPanel.Visible = false;
+          splitContainer.Enabled = true;
+          this.Cursor = Cursors.Default;
+          SetEnabledStateOfControls();
+        }));
+      });
+    }
+    #endregion
+
+    #region Load Results
+    private void LoadResultsAsync(int batchSize) {
       bool deserialize = deserializeBlobsCheckBox.Checked;
 
-      System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
-      sw.Start();
-      long count = OKBClient.Instance.GetNumberOfQueryResults(combinedFilterView.Content);
-      sw.Stop();
-      MessageBox.Show(count.ToString() + " Runs");
-      if (MessageBox.Show(sw.Elapsed.ToString(), "GetNumberOfQueryResults", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return;
+      Cursor = Cursors.AppStarting;
+      resultsInfoLabel.Text = "Loading Results ...";
+      resultsProgressBar.Value = 0;
+      resultsProgressBar.Step = batchSize;
+      abortButton.Enabled = true;
+      resultsInfoPanel.Visible = true;
+      splitContainer.Enabled = false;
+      cancellationTokenSource = new CancellationTokenSource();
+      CancellationToken cancellationToken = cancellationTokenSource.Token;
 
-      sw.Restart();
-      var ids = OKBClient.Instance.GetQueryResultIds(combinedFilterView.Content);
-      sw.Stop();
-      if (MessageBox.Show(sw.Elapsed.ToString(), "GetQueryResultIds", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return;
+      Task task = Task.Factory.StartNew(() => {
+        var ids = OKBClient.Instance.GetQueryResultIds(combinedFilterView.Content);
+        int idsCount = ids.Count();
 
-      sw.Restart();
-      List<QueryResult> results = new List<QueryResult>();
-      while (ids.Count() > 0) {
-        results.AddRange(OKBClient.Instance.GetQueryResults(ids.Take(50)));
-        ids = ids.Skip(50);
-      }
-      sw.Stop();
-      if (MessageBox.Show(sw.Elapsed.ToString(), "GetQueryResults", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return;
+        Invoke(new Action(() => {
+          resultsInfoLabel.Text = "Loaded 0 of " + idsCount.ToString() + " Results ...";
+          resultsProgressBar.Maximum = idsCount;
+        }));
 
-      sw.Restart();
-      IEnumerable<QueryResult> res = results.AsEnumerable();
-      RunCollection runs = new RunCollection();
-      runCollectionView.Content = runs;
-      while (res.Count() > 0) {
-        runs.AddRange(res.Take(50).Select(x => ConvertToOptimizationRun(x, deserialize)));
-        res = res.Skip(50);
-      }
-      sw.Stop();
-      MessageBox.Show(sw.Elapsed.ToString(), "Conversion", MessageBoxButtons.OK);
+        RunCollection runs = new RunCollection();
+        runs.CollectionReset += new Collections.CollectionItemsChangedEventHandler<IRun>(runs_CollectionReset);
+        runCollectionView.Content = runs;
+        while (ids.Count() > 0) {
+          cancellationToken.ThrowIfCancellationRequested();
+          runs.AddRange(OKBClient.Instance.GetQueryResults(ids.Take(batchSize)).Select(x => ConvertToOptimizationRun(x, deserialize)));
+          ids = ids.Skip(batchSize);
+          Invoke(new Action(() => {
+            resultsInfoLabel.Text = "Loaded " + runs.Count + " of " + idsCount.ToString() + " Results ...";
+            resultsProgressBar.PerformStep();
+          }));
+        }
+      }, cancellationToken);
+      task.ContinueWith(t => {
+        Invoke(new Action(() => {
+          cancellationTokenSource.Dispose();
+          cancellationTokenSource = null;
+          resultsInfoPanel.Visible = false;
+          splitContainer.Enabled = true;
+          this.Cursor = Cursors.Default;
+          SetEnabledStateOfControls();
+        }));
+      });
+    }
 
-      SetEnabledStateOfControls();
+    void runs_CollectionReset(object sender, Collections.CollectionItemsChangedEventArgs<IRun> e) {
+    }
+    #endregion
+
+    private void refreshResultsButton_Click(object sender, EventArgs e) {
+      LoadResultsAsync(10);
+    }
+
+    private void abortButton_Click(object sender, EventArgs e) {
+      if (cancellationTokenSource != null) cancellationTokenSource.Cancel();
+      abortButton.Enabled = false;
     }
 
