Exemple #1
0
 /// <summary>
 /// 重置信号量。所有处于等待中信号量的异步操作都会抛出OperationCanceledException异常
 /// </summary>
 public void Reset()
 {
     _status    = SourceStatus.Pending;
     _token     = AllocateId();
     _exception = null;
     Complete();
 }
Exemple #2
0
 private UnityEventSource()
 {
     _eventListener = () => {
         _status = SourceStatus.Succeeded;
         UnregisterListener();
         _continuation();
     };
 }
Exemple #3
0
 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;
         }
     }
 }
Exemple #4
0
 public void SetCanceled()
 {
     AssertPending();
     _status = SourceStatus.Canceled;
     Complete();
 }
Exemple #5
0
 private void Reset()
 {
     _status    = SourceStatus.Pending;
     _exception = null;
     _result    = default(T);
 }
Exemple #6
0
 /// <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;
 }
Exemple #7
0
 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;
Exemple #10
0
 public IChatWPFPlugin()
 {
     Muted  = false;
     Status = SourceStatus.Offline;
 }
Exemple #11
0
 public void SetResult()
 {
     AssertPending();
     _status = SourceStatus.Succeeded;
     Complete();
 }
Exemple #12
0
 public void Lock()
 {
     _status = SourceStatus.Pending;
 }
Exemple #13
0
 public BaseStatusEvent(SourceStatus status)
 {
     Status = status;
 }
Exemple #14
0
 public virtual bool isValidStatus(SourceStatus status)
 {
     return((status == SourceStatus.Charging || status == SourceStatus.NotPresent || status == SourceStatus.Ready || status == SourceStatus.Sourcing) ? true : false);
 }
Exemple #15
0
 public FileSaveStatus InitSourceUpload(UserIdentity userIdentity, ResourceDescriptor resourceDescriptor, SourceStatus status, out string otherResourceId)
 {
     return _serverSideSourceTransfer.InitSourceUpload(userIdentity, resourceDescriptor, status, out otherResourceId);
 }
Exemple #16
0
 public void Initialize(UnityEvent unityEvent)
 {
     _status     = SourceStatus.Pending;
     _unityEvent = unityEvent;
     Token       = AllocateToken();
 }
Exemple #17
0
 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);
 }
Exemple #20
0
 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;
 }
Exemple #22
0
 public FileSaveStatus InitSourceUpload(UserIdentity userIdentity, ResourceDescriptor resourceDescriptor,
                                        SourceStatus status, out string otherResourceId)
 {
     return _presentationWorker.InitSourceUpload(userIdentity, resourceDescriptor, status, out otherResourceId);
 }
Exemple #23
0
 public void OnCompleted() => Status = SourceStatus.Completed;
Exemple #24
0
        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);
        }
Exemple #25
0
 public void OnNext(IEnergyObservation value) => Status = SourceStatus.Running;
Exemple #26
0
 /// <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;
 }