using System; namespace MonoDevelop.ConnectedServices { /// /// Event args that describe the current status of the service or dependency /// public sealed class StatusChangedEventArgs : EventArgs { /// /// Initializes a new instance of the class. /// public StatusChangedEventArgs (Status newStatus, Status oldStatus, Exception error = null) { this.NewStatus = newStatus; this.OldStatus = oldStatus; this.Error = error; } /// /// Gets the new status of the service or dependency at the time of the event /// public Status NewStatus { get; private set; } /// /// Gets the old status of the service or dependency at the time of the event /// public Status OldStatus { get; private set; } /// /// Gets the exception that occurred in the event of failures /// public Exception Error { get; private set; } /// /// Gets a value indicating if the status change was a result of being added to the project /// public bool WasAdded { get { return this.NewStatus == Status.Added && (this.OldStatus == Status.Adding || this.OldStatus == Status.NotAdded); }} /// /// Gets a value indicating if the status change was a result of being added to the project /// public bool WasRemoved { get { return this.NewStatus == Status.NotAdded && (this.OldStatus == Status.Removing || this.OldStatus == Status.Added); } } /// /// Gets a value indicating if the current status is that of being added to the project /// public bool IsAdding { get { return this.NewStatus == Status.Adding && this.OldStatus == Status.NotAdded; } } /// /// Gets a value indicating if the current status is that of being removed from the project /// public bool IsRemoving { get { return this.NewStatus == Status.Removing && this.OldStatus == Status.Added; } } /// /// Gets a value indicating if the current status is that the adding to the project failed /// public bool DidAddingFail { get { return this.NewStatus == Status.NotAdded && this.OldStatus == Status.Adding; } } /// /// Gets a value indicating if the current status is that the removing from the project failed /// public bool DidRemovingFail { get { return this.NewStatus == Status.NotAdded && this.OldStatus == Status.Adding; } } } }