示例#1
0
        public void Suspend()
        {
            if (!Running)
            {
                return;
            }

            Running = false;
            Suspended?.Invoke(this);
        }
示例#2
0
 /// <summary>
 /// Приостановить работу модуля.
 /// </summary>
 public async ValueTask <Nothing> SuspendModule()
 {
     if (_suspendedAware && Interlocked.Exchange(ref _isSuspended, 1) == 0)
     {
         if (_suspendAwareCallbacks != null)
         {
             await _suspendAwareCallbacks.OnSuspendLifetimeCallback();
         }
         Suspended?.Invoke(null);
     }
     return(Nothing.Value);
 }
示例#3
0
        public async Task SuspendAsync()
        {
            this.LogInfo();

            Suspending?.Invoke(this, EventArgs.Empty);

            // save the navigation state
            await FrameLogic.SaveNavigationState(Id, _frame);

            // call the view-model's OnSuspending
            await SuspensionLogic.CallSuspendAsync(CurrentViewModel as ISuspensionAware);

            Suspended?.Invoke(this, EventArgs.Empty);
        }
示例#4
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Agent != null)
         {
             hashCode = hashCode * 59 + Agent.GetHashCode();
         }
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (UserId != null)
         {
             hashCode = hashCode * 59 + UserId.GetHashCode();
         }
         if (CreatedAt != null)
         {
             hashCode = hashCode * 59 + CreatedAt.GetHashCode();
         }
         if (LegacyProfile != null)
         {
             hashCode = hashCode * 59 + LegacyProfile.GetHashCode();
         }
         if (Suspended != null)
         {
             hashCode = hashCode * 59 + Suspended.GetHashCode();
         }
         if (Paid != null)
         {
             hashCode = hashCode * 59 + Paid.GetHashCode();
         }
         if (Migrated != null)
         {
             hashCode = hashCode * 59 + Migrated.GetHashCode();
         }
         if (Legacy != null)
         {
             hashCode = hashCode * 59 + Legacy.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#5
0
 /// <summary>
 /// Приостановить работу модуля.
 /// </summary>
 public async ValueTask <Nothing> SuspendModule()
 {
     if (Interlocked.Exchange(ref _isSuspended, 1) == 0)
     {
         List <ValueTask <Nothing> > tasks = new List <ValueTask <Nothing> >();
         foreach (var pt in _providers.Values)
         {
             foreach (var p in pt.Select(p => p.QueryView <IModuleLifetime>()).Where(p => p != null && p.IsSuspendAware))
             {
                 tasks.Add(p.SuspendModule());
             }
         }
         foreach (var task in tasks)
         {
             await task;
         }
         Suspended?.Invoke(null);
     }
     return(Nothing.Value);
 }
示例#6
0
        public IActionResult SuspendedCreate(vmSuspended VmSuspended)
        {
            if (ModelState.IsValid)
            {
                Suspended suspended = new Suspended()
                {
                    EmployeeId = VmSuspended.EmployeeId,
                    FromDate   = VmSuspended.FromDate,
                    ToDate     = VmSuspended.ToDate != null ? VmSuspended.ToDate : DateTime.Now,

                    Reason = VmSuspended.Reason,
                    Status = ApplicationStatus.Pending
                };

                db.Suspended.Add(suspended);
                db.Save();

                return(Json(true));
            }

            return(Json(false));
        }
示例#7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (DisplayName.Length != 0)
            {
                hash ^= DisplayName.GetHashCode();
            }
            if (ExternalId.Length != 0)
            {
                hash ^= ExternalId.GetHashCode();
            }
            if (Size != 0)
            {
                hash ^= Size.GetHashCode();
            }
            if (HeadquartersAddress.Length != 0)
            {
                hash ^= HeadquartersAddress.GetHashCode();
            }
            if (HiringAgency != false)
            {
                hash ^= HiringAgency.GetHashCode();
            }
            if (EeoText.Length != 0)
            {
                hash ^= EeoText.GetHashCode();
            }
            if (WebsiteUri.Length != 0)
            {
                hash ^= WebsiteUri.GetHashCode();
            }
            if (CareerSiteUri.Length != 0)
            {
                hash ^= CareerSiteUri.GetHashCode();
            }
            if (ImageUri.Length != 0)
            {
                hash ^= ImageUri.GetHashCode();
            }
            hash ^= keywordSearchableJobCustomAttributes_.GetHashCode();
            if (derivedInfo_ != null)
            {
                hash ^= DerivedInfo.GetHashCode();
            }
            if (Suspended != false)
            {
                hash ^= Suspended.GetHashCode();
            }
            if (LearningType != 0)
            {
                hash ^= LearningType.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#8
0
        /// <summary>
        /// Returns true if GameProfile instances are equal
        /// </summary>
        /// <param name="other">Instance of GameProfile to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(GameProfile other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Agent == other.Agent ||
                     Agent != null &&
                     Agent.Equals(other.Agent)
                     ) &&
                 (
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     UserId == other.UserId ||
                     UserId != null &&
                     UserId.Equals(other.UserId)
                 ) &&
                 (
                     CreatedAt == other.CreatedAt ||
                     CreatedAt != null &&
                     CreatedAt.Equals(other.CreatedAt)
                 ) &&
                 (
                     LegacyProfile == other.LegacyProfile ||
                     LegacyProfile != null &&
                     LegacyProfile.Equals(other.LegacyProfile)
                 ) &&
                 (
                     Suspended == other.Suspended ||
                     Suspended != null &&
                     Suspended.Equals(other.Suspended)
                 ) &&
                 (
                     Paid == other.Paid ||
                     Paid != null &&
                     Paid.Equals(other.Paid)
                 ) &&
                 (
                     Migrated == other.Migrated ||
                     Migrated != null &&
                     Migrated.Equals(other.Migrated)
                 ) &&
                 (
                     Legacy == other.Legacy ||
                     Legacy != null &&
                     Legacy.Equals(other.Legacy)
                 ));
        }
示例#9
0
 protected override void OnSuspend()
 {
     Suspended?.Invoke(this, EventArgs.Empty);
 }
示例#10
0
 public void OnConnectionSuspended(int cause) =>
 Suspended?.Invoke(cause);
示例#11
0
        public void Suspend()
        {
            Running = false;

            Suspended?.Invoke(this);
        }
示例#12
0
 public virtual void Suspend()
 {
     State = SceneState.SUSPENDED;
     Suspended?.Invoke(this, new EventArgs());
     Stopped?.Invoke(this, new EventArgs());
 }