/// <summary> /// 重置信号量。所有处于等待中信号量的异步操作都会抛出OperationCanceledException异常 /// </summary> public void Reset() { _status = SourceStatus.Pending; _token = AllocateId(); _exception = null; Complete(); }
private UnityEventSource() { _eventListener = () => { _status = SourceStatus.Succeeded; UnregisterListener(); _continuation(); }; }
public void Release() { if (_continuations.Count == 0) { _status = SourceStatus.Succeeded; } else { do { var continuation = _continuations[0]; _continuations.RemoveAt(0); continuation(); }while(_status != SourceStatus.Pending && _continuations.Count > 0); if (_continuations.Count == 0) { _status = SourceStatus.Succeeded; } } }
public void SetCanceled() { AssertPending(); _status = SourceStatus.Canceled; Complete(); }
private void Reset() { _status = SourceStatus.Pending; _exception = null; _result = default(T); }
/// <summary> /// Initializes a new instance of the <see cref="SourceDetailResponse" /> class. /// </summary> /// <param name="Id">Unique identifier for the source resource. (required).</param> /// <param name="Name">Descriptive name for the source..</param> /// <param name="CreatedDate">Date and time the source was created. (required).</param> /// <param name="Description">Descriptive name for the source..</param> /// <param name="Configuration">Specific configuration of the source..</param> /// <param name="Type">Type (required).</param> /// <param name="Status">Status (required).</param> public SourceDetailResponse(string Id = default(string), string Name = default(string), DateTime?CreatedDate = default(DateTime?), string Description = default(string), Object Configuration = default(Object), SourceType Type = default(SourceType), SourceStatus Status = default(SourceStatus)) { // to ensure "Id" is required (not null) if (Id == null) { throw new InvalidDataException("Id is a required property for SourceDetailResponse and cannot be null"); } else { this.Id = Id; } // to ensure "CreatedDate" is required (not null) if (CreatedDate == null) { throw new InvalidDataException("CreatedDate is a required property for SourceDetailResponse and cannot be null"); } else { this.CreatedDate = CreatedDate; } // to ensure "Type" is required (not null) if (Type == null) { throw new InvalidDataException("Type is a required property for SourceDetailResponse and cannot be null"); } else { this.Type = Type; } // to ensure "Status" is required (not null) if (Status == null) { throw new InvalidDataException("Status is a required property for SourceDetailResponse and cannot be null"); } else { this.Status = Status; } this.Name = Name; this.Description = Description; this.Configuration = Configuration; }
public void OnError(Exception error) => Status = SourceStatus.Failed;
public virtual FileSaveStatus SaveSource(UserIdentity userIdentity, ResourceDescriptor resourceDescriptor, SourceStatus status, out string newResourceId) { throw new System.NotImplementedException(); }
public void OnNext(T value) => Status = SourceStatus.Running;
public IChatWPFPlugin() { Muted = false; Status = SourceStatus.Offline; }
public void SetResult() { AssertPending(); _status = SourceStatus.Succeeded; Complete(); }
public void Lock() { _status = SourceStatus.Pending; }
public BaseStatusEvent(SourceStatus status) { Status = status; }
public virtual bool isValidStatus(SourceStatus status) { return((status == SourceStatus.Charging || status == SourceStatus.NotPresent || status == SourceStatus.Ready || status == SourceStatus.Sourcing) ? true : false); }
public FileSaveStatus InitSourceUpload(UserIdentity userIdentity, ResourceDescriptor resourceDescriptor, SourceStatus status, out string otherResourceId) { return _serverSideSourceTransfer.InitSourceUpload(userIdentity, resourceDescriptor, status, out otherResourceId); }
public void Initialize(UnityEvent unityEvent) { _status = SourceStatus.Pending; _unityEvent = unityEvent; Token = AllocateToken(); }
public FileSaveStatus SaveSource(UserIdentity userIdentity, ResourceDescriptor resourceDescriptor, SourceStatus status, out string otherResourceId) { otherResourceId = null; return null == SaveSource(userIdentity, resourceDescriptor) ? FileSaveStatus.Abort : FileSaveStatus.Ok; }
public override FileSaveStatus SaveSource(UserIdentity userIdentity, ResourceDescriptor resourceDescriptor, SourceStatus status, out string otherResourceId) { return _serverSideSourceTransfer.SaveSource(userIdentity, resourceDescriptor, status, out otherResourceId); }
public SourceBuilder WithConverter(ILanguageConverter languageConverter) { _converter = languageConverter ?? throw new ArgumentNullException(nameof(languageConverter)); Status = SourceStatus.ReadyForParsing; return(this); }
public FileSaveStatus SaveDeviceSource(UserIdentity userIdentity, DeviceResourceDescriptor resourceDescriptor, SourceStatus status) { string otherResourceId; return _presentationWorker.SaveDeviceSource(userIdentity, resourceDescriptor, status, out otherResourceId); }
public FileSaveStatus SaveDeviceSource(UserIdentity userIdentity, DeviceResourceDescriptor resourceDescriptor, SourceStatus status, out string newResourceId) { newResourceId = null; if (status == SourceStatus.New && _deviceSourceDAL.IsExists(resourceDescriptor)) return FileSaveStatus.Exists; return null == _deviceSourceDAL.SaveSource(userIdentity, resourceDescriptor) ? FileSaveStatus.Exists : FileSaveStatus.Ok; }
public FileSaveStatus InitSourceUpload(UserIdentity userIdentity, ResourceDescriptor resourceDescriptor, SourceStatus status, out string otherResourceId) { return _presentationWorker.InitSourceUpload(userIdentity, resourceDescriptor, status, out otherResourceId); }
public void OnCompleted() => Status = SourceStatus.Completed;
private async Task <SourceStatus> DeleteSource(IStorageFeed feed, PackageName packageName, SourceStatus sourceStatus) { var newSourceStatus = new SourceStatus(sourceStatus.SourceName); if (sourceStatus.Stored) { try { Debug.WriteLine("Deleting source {0}", sourceStatus.SourceName); newSourceStatus.Stored = true; await RequestOrSkip(string.Format("src/{0}", sourceStatus.SourceName), async() => { var source = feed.GetSource(packageName, sourceStatus.SourceName); await source.Delete(); }); newSourceStatus.Stored = false; Debug.WriteLine("Deleted source {0}", sourceStatus.SourceName); } catch (Exception e) { support.TrackException(e, new { packageName }); newSourceStatus.Exception = new ExceptionStatus(e); } } return(newSourceStatus); }
public void OnNext(IEnergyObservation value) => Status = SourceStatus.Running;
/// <summary> /// Initializes a new instance of the <see cref="SourceSummaryResponse" /> class. /// </summary> /// <param name="Id">Unique identifier for the source resource. (required).</param> /// <param name="Name">Descriptive name for the source..</param> /// <param name="CreatedDate">Date and time the source was created. (required).</param> /// <param name="Type">Type (required).</param> /// <param name="Status">Status.</param> public SourceSummaryResponse(string Id = default(string), string Name = default(string), DateTime?CreatedDate = default(DateTime?), SourceType Type = default(SourceType), SourceStatus Status = default(SourceStatus)) { // to ensure "Id" is required (not null) if (Id == null) { throw new InvalidDataException("Id is a required property for SourceSummaryResponse and cannot be null"); } else { this.Id = Id; } // to ensure "CreatedDate" is required (not null) if (CreatedDate == null) { throw new InvalidDataException("CreatedDate is a required property for SourceSummaryResponse and cannot be null"); } else { this.CreatedDate = CreatedDate; } // to ensure "Type" is required (not null) if (Type == null) { throw new InvalidDataException("Type is a required property for SourceSummaryResponse and cannot be null"); } else { this.Type = Type; } this.Name = Name; this.Status = Status; }