#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; namespace OSGeo.MapGuide.MaestroAPI { /// /// A delegate used to represent relay progress for lengthy operations /// /// /// public delegate void LengthyOperationCallBack(object sender, LengthyOperationCallbackArgs items); /// /// A delegate used to represent relay progress for lengthy operations /// /// /// public delegate void LengthyOperationProgressCallBack(object sender, LengthyOperationProgressArgs e); /// /// Represents progress of a lengthy operation /// public class LengthyOperationProgressArgs { /// /// The message /// public string StatusMessage; /// /// The progress percentage /// public int Progress; /// /// Indicates whether a cancel request has been made /// public bool Cancel; /// /// Initializes a new instance of the class. /// /// The message. /// The progress. public LengthyOperationProgressArgs(string message, int progress) { StatusMessage = message; Progress = progress; Cancel = false; } } /// /// Represents progress of a lengthy operation /// public class LengthyOperationCallbackArgs { private LengthyOperationItem[] m_items; private int m_index; private bool m_cancel; /// /// Initializes a new instance of the class. /// /// The items. public LengthyOperationCallbackArgs(LengthyOperationItem[] items) { m_items = items; m_index = 0; m_cancel = false; } /// /// Gets or sets whether this lengthy operation should be cancelled /// public bool Cancel { get { return m_cancel; } set { m_cancel = value; } } /// /// Gets or sets the index /// public int Index { get { return m_index; } set { m_index = value; } } /// /// Gets the operation items /// public LengthyOperationItem[] Items { get { return m_items; } } /// /// /// public class LengthyOperationItem { /// /// Defines the possible operation status values /// public enum OperationStatus { /// /// None /// None, /// /// Pending /// Pending, /// /// Success /// Success, /// /// Failure /// Failure } private string m_itempath; private OperationStatus m_status; /// /// Gets the item path /// public string Itempath { get { return m_itempath; } } /// /// Gets or sets the operation status /// public OperationStatus Status { get { return m_status; } set { m_status = value; } } /// /// Initializes a new instance of the class. /// /// The path. public LengthyOperationItem(string path) { m_itempath = path; m_status = OperationStatus.None; } } } }