/// <summary>Imports the keys with the given IDs from the given key server.</summary>
  void ImportKeys(string[] ids, Uri keyServer)
  {
    if(TaskInProgress) throw new InvalidOperationException("A search or import is in progress.");

    thread = new Thread((ThreadStart)delegate
    {
      ImportedKey[] results;
      try { results = PGP.ImportKeysFromServer(new KeyDownloadOptions(keyServer), keyring, ids); }
      catch(Exception ex)
      {
        Invoke((ThreadStart)delegate { ImportFailed(ex); });
        return;
      }

      Invoke((ThreadStart)delegate { ImportFinished(results); });
    });

    UpdateButtons();

    progressBar.Style = ProgressBarStyle.Marquee;
    thread.Start();
  }