#region Disclaimer / License // Copyright (C) 2009, Kenneth Skovhede // http://www.hexad.dk, opensource@hexad.dk // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #endregion using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Duplicati.GUI.HelperControls { public partial class WaitForOperation : Form { private Exception m_exception; public WaitForOperation() { InitializeComponent(); } public void Setup(DoWorkEventHandler callback, string title) { backgroundWorker1.DoWork += callback; this.Text = title; } private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { m_exception = e.Error; if (e.Cancelled || e.Error != null) this.DialogResult = DialogResult.Cancel; else this.DialogResult = DialogResult.OK; this.Close(); } private void WaitForOperation_Load(object sender, EventArgs e) { backgroundWorker1.RunWorkerAsync(); } public Exception Error { get { return m_exception; } } } }