protected override void WhenGestureDeactivated(Hand maybeNullHand, DeactivationReason reason) { //_pinchDistanceBuffer.Clear(); OnClose(); }
public override void OnDeactivated(DeactivationReason reason) { UnregisterReceiver(mReceiver); Muted = true; BluetoothChatService.ApduHost = null; Console.WriteLine("{1} Deactivated:{0}", reason, DateTime.UtcNow.Ticks); }
protected override void WhenGestureDeactivated(Hand maybeNullHand, DeactivationReason reason) { base.WhenGestureDeactivated(maybeNullHand, reason); if (maybeNullHand != null) { Chirality chirality = Chirality.Right; if (maybeNullHand.IsLeft) { chirality = Chirality.Left; } handColourManager.setHandColorMode(chirality, handColourManager.handModes.none); //erase. switch (reason) { case DeactivationReason.FinishedGesture: if (cancelLatticeLandPoint(maybeNullHand)) { foreach (LatticeLandPoint lp in GameObject.FindObjectsOfType <LatticeLandPoint>().Where(l => l.GetComponent <LineRenderer>() != null).ToList()) { //steal this from AbstractLineSegment Vector3 a = lp.GetComponent <LineRenderer>().GetPosition(0); Vector3 b = lp.GetComponent <LineRenderer>().GetPosition(1); Vector3 c = maybeNullHand.PalmPosition.ToVector3(); Vector3 result = Vector3.Dot(c - a, (b - a).normalized) * (b - a).normalized + a; if ((result - a).magnitude + (result - b).magnitude > (a - b).magnitude) { //the point is outside the endpoints, find closest endpoint instead. if ((result - a).magnitude < (result - b).magnitude) { result = a; } else { result = b; } } float distance = (maybeNullHand.PalmPosition.ToVector3() - result).magnitude; if (distance < maximumRangeToSelect && lp.whichHand != this.whichHand) { lp.endInteraction(); } } } else if (foundMGO(maybeNullHand)) { closestObj.DeleteGeoObj(); } break; case DeactivationReason.CancelledGesture: break; default: break; } } }
protected override void WhenGestureDeactivated(Hand maybeNullLeftHand, Hand maybeNullRightHand, DeactivationReason reason) { base.WhenGestureDeactivated(maybeNullLeftHand, maybeNullRightHand, reason); leftMinusRightHandPosBuffer.Clear(); }
public override async Task OnDeactivateAsync(DeactivationReason reason, CancellationToken cancellationToken) { if (logger.IsEnabled(LogLevel.Debug)) { logger.LogDebug("OnDeactivateAsync"); } await RecordDeactivate(); }
public override async Task OnDeactivateAsync(DeactivationReason reason, CancellationToken cancellationToken) { _logger.LogInformation("Consumer.OnDeactivateAsync"); await StopConsuming(); _numConsumedItems = 0; await base.OnDeactivateAsync(reason, cancellationToken); }
public override void OnDeactivated([GeneratedEnum] DeactivationReason reason) { if (dataToPublish != null && !confirmed) { ShowToast("Sending Flag Carrier HCE data was interrupted."); } ndefData = null; }
protected override void WhenGestureDeactivated(Hand maybeNullHand, DeactivationReason reason) { base.WhenGestureDeactivated(maybeNullHand, reason); if (reason == DeactivationReason.FinishedGesture) { myStraightEdge.shipsWheel_revolve.GetComponentInChildren <shipsWheelControl>().revolve(true); playSuccessSound(); } }
public override async Task OnDeactivateAsync(DeactivationReason reason, CancellationToken cancellationToken) { logger.LogInformation("OnDeactivateAsync"); Assert.False(doingActivate, "Activate method should have finished"); Assert.False(doingDeactivate, "Not doing Deactivate yet"); doingDeactivate = true; await watcher.RecordDeactivateCall(RuntimeHelpers.GetHashCode(this).ToString("X")); Assert.True(doingDeactivate, "Deactivate method still running"); doingDeactivate = false; }
protected override void WhenGestureDeactivated(Hand maybeNullHand, DeactivationReason reason) { if ((reason == DeactivationReason.CancelledGesture && !forgiving) || reason == DeactivationReason.FinishedGesture) { if (pinA != null || pinB != null) { playErrorSound(); } pinB = null; pinA = null; } }
/// <summary> /// On Gesture end /// </summary> /// <param name="maybeNullHand">Hand reference that ended the gesture</param> /// <param name="reason">reason the gesture was ended</param> protected override void WhenGestureDeactivated(Hand maybeNullHand, DeactivationReason reason) { this.thisLR.enabled = false; if (maybeNullHand != null) { switch (reason) { case DeactivationReason.FinishedGesture: playSuccessSound(); if (maybeNullHand.Fingers[0].IsExtended) { //thumb up is draw polygon if (prevSet && currSet && _prevPoint != _currPoint) { lineList.Add(GeoObjConstruction.dLineSegment(currPoint, prevPoint)); int idx = pointList.LastIndexOf(_currPoint); int idx2 = pointList.IndexOf(_currPoint); if (idx > idx2 && lineList.Count > 1) { List <AbstractPoint> p1 = pointList.GetRange(idx2, (idx) - idx2); List <AbstractLineSegment> l1 = lineList.Where(l => p1.Contains(l.GetComponent <DependentLineSegment>().point1) || p1.Contains(l.GetComponent <DependentLineSegment>().point2)).ToList(); //TODO: Point list is overpopulated. CodyCodyCodyCodyCodyCody GeoObjConstruction.iPolygon(l1, p1); endInteraction(); } } } else { //thumb down is draw wireframe if (prevSet && currSet && _prevPoint != _currPoint) { lineList.Add(GeoObjConstruction.dLineSegment(currPoint, prevPoint)); } } break; default: break; } Chirality chirality = Chirality.Right; if (maybeNullHand.IsLeft) { chirality = Chirality.Left; } handColourManager.setHandColorMode(chirality, handColourManager.handModes.none); } }
public override Task OnDeactivateAsync(DeactivationReason reason, CancellationToken cancellationToken) { logger.LogInformation("OnDeactivateAsync"); Assert.False(doingActivate, "Activate method should have finished"); Assert.False(doingDeactivate, "Not doing Deactivate yet"); doingDeactivate = true; return(watcher.RecordDeactivateCall(RuntimeHelpers.GetHashCode(this).ToString("X")) .ContinueWith((Task t) => { Assert.False(t.IsFaulted, "RecordDeactivateCall failed"); Assert.True(doingDeactivate, "Doing Deactivate"); doingDeactivate = false; })); }
private void playFeedback(DeactivationReason reason) { switch (reason) { case DeactivationReason.FinishedGesture: break; case DeactivationReason.CancelledGesture: playBoundNoise(); break; default: break; } }
void IUserAccountsCommand.DeactivateUserAccount(IUserAccount user, DeactivationReason reason, string comments) { // Deactivated themselves. _repository.DeactivateUserAccount(user.Id, user.Id, DateTime.Now, reason, comments); // Fire events. var handlers = UserDeactivated; if (handlers != null) { handlers(this, new UserDeactivatedEventArgs(user.Id, user.UserType, user.Id, reason, comments)); } }
/// <summary> /// Gracefully deletes activations, putting it into a shutdown state to /// complete and commit outstanding transactions before deleting it. /// To be called not from within Activation context, so can be awaited. /// </summary> internal async Task DeactivateActivations(DeactivationReason reason, List <IGrainContext> list) { if (list == null || list.Count == 0) { return; } if (logger.IsEnabled(LogLevel.Debug)) { logger.Debug("DeactivateActivations: {0} activations.", list.Count); } var timeoutTokenSource = new CancellationTokenSource(this.collectionOptions.Value.DeactivationTimeout); await Task.WhenAll(list.Select(activation => activation.DeactivateAsync(reason, timeoutTokenSource.Token))); }
public override void OnDeactivated(DeactivationReason reason) { logger.Info("Deactivated: {0} after {1}ms", reason.ToString(), stopwatch.ElapsedMilliseconds); Android.Media.Stream amStream = Android.Media.Stream.Music; int iTonGeneratorVolume = 100; var toneG = new Android.Media.ToneGenerator(amStream, iTonGeneratorVolume); toneG.StartTone(Android.Media.Tone.PropBeep); (socket as IDisposable).Dispose(); IsTransacting = false; }
public Task DeleteActivations(List <GrainAddress> addresses, DeactivationReasonCode reasonCode, string reasonText) { var timeoutTokenSource = new CancellationTokenSource(this.collectionOptions.Value.DeactivationTimeout); var tasks = new List <Task>(addresses.Count); var deactivationReason = new DeactivationReason(reasonCode, reasonText); foreach (var activationAddress in addresses) { if (TryGetGrainContext(activationAddress.GrainId, out var grainContext)) { tasks.Add(grainContext.DeactivateAsync(deactivationReason, timeoutTokenSource.Token)); } } return(Task.WhenAll(tasks)); }
internal void StartDeactivatingActivations(DeactivationReason reason, List <IGrainContext> list) { if (list == null || list.Count == 0) { return; } if (logger.IsEnabled(LogLevel.Debug)) { logger.Debug("DeactivateActivations: {0} activations.", list.Count); } var timeoutTokenSource = new CancellationTokenSource(this.collectionOptions.Value.DeactivationTimeout); foreach (var activation in list) { activation.DeactivateAsync(reason, timeoutTokenSource.Token); } }
public override async Task OnDeactivateAsync(DeactivationReason reason, CancellationToken cancellationToken) { logger.LogInformation("OnDeactivateAsync"); Assert.False(doingActivate, "Not doing Activate yet"); Assert.False(doingDeactivate, "Not doing Deactivate yet"); doingDeactivate = true; logger.LogInformation("Started-OnDeactivateAsync"); await watcher.RecordDeactivateCall(RuntimeHelpers.GetHashCode(this).ToString("X")); Assert.True(doingDeactivate, "Doing Deactivate"); logger.LogInformation("OnDeactivateAsync-Sleep"); Thread.Sleep(TimeSpan.FromSeconds(1)); logger.LogInformation("Finished-OnDeactivateAsync"); doingDeactivate = false; }
public Task DeactivateAllActivations() { logger.Info(ErrorCode.Catalog_DeactivateAllActivations, "DeactivateAllActivations."); var activationsToShutdown = new List <IGrainContext>(); foreach (var pair in activations) { var activation = pair.Value; if (activation is not ICollectibleGrainContext collectible || collectible.IsExemptFromCollection) { continue; } activationsToShutdown.Add(activation); } var reason = new DeactivationReason(DeactivationReasonCode.ShuttingDown, "This process is terminating"); return(DeactivateActivations(reason, activationsToShutdown)); }
public override Task OnDeactivateAsync(DeactivationReason reason, CancellationToken cancellationToken) { Task.Factory.StartNew(() => logger.LogInformation("OnDeactivateAsync")); Assert.False(doingActivate, "Not doing Activate"); Assert.False(doingDeactivate, "Not doing Deactivate"); doingDeactivate = true; logger.LogInformation("Started-OnDeactivateAsync"); return(watcher.RecordDeactivateCall(RuntimeHelpers.GetHashCode(this).ToString("X")) .ContinueWith((Task t) => { Assert.False(t.IsFaulted, "RecordDeactivateCall failed"); Assert.True(doingDeactivate, "Doing Deactivate"); Thread.Sleep(TimeSpan.FromSeconds(1)); doingDeactivate = false; }) .ContinueWith((Task t) => logger.LogInformation("Finished-OnDeactivateAsync"), TaskContinuationOptions.ExecuteSynchronously)); }
/// <summary> /// On Gesture end /// </summary> /// <param name="maybeNullHand">Hand reference that ended the gesture</param> /// <param name="reason">reason the gesture was ended</param> protected override void WhenGestureDeactivated(Hand maybeNullHand, DeactivationReason reason) { //sethandMNodeNone switch (reason) { case DeactivationReason.FinishedGesture: break; //case DeactivationReason.CancelledGesture: // if (!completeBool) // //playErrorSound(); // break; default: break; } if (maybeNullHand != null) { handColourManager.setHandColorMode(whichHand, handColourManager.handModes.none); StartCoroutine(gestureCooldown()); } }
// TODO move this logic in the LocalGrainDirectory private void OnSiloStatusChange(SiloAddress updatedSilo, SiloStatus status) { // ignore joining events and also events on myself. if (updatedSilo.Equals(LocalSilo)) { return; } // We deactivate those activations when silo goes either of ShuttingDown/Stopping/Dead states, // since this is what Directory is doing as well. Directory removes a silo based on all those 3 statuses, // thus it will only deliver a "remove" notification for a given silo once to us. Therefore, we need to react the fist time we are notified. // We may review the directory behavior in the future and treat ShuttingDown differently ("drain only") and then this code will have to change a well. if (!status.IsTerminating()) { return; } if (status == SiloStatus.Dead) { this.RuntimeClient.BreakOutstandingMessagesToDeadSilo(updatedSilo); } var activationsToShutdown = new List <IGrainContext>(); try { // scan all activations in activation directory and deactivate the ones that the removed silo is their primary partition owner. lock (activations) { foreach (var activation in activations) { try { var activationData = activation.Value; var placementStrategy = activationData.GetComponent <PlacementStrategy>(); var isUsingGrainDirectory = placementStrategy is { IsUsingGrainDirectory : true }; if (!isUsingGrainDirectory || grainDirectoryResolver.HasNonDefaultDirectory(activationData.GrainId.Type)) { continue; } if (!updatedSilo.Equals(directory.GetPrimaryForGrain(activationData.GrainId))) { continue; } activationsToShutdown.Add(activationData); } catch (Exception exc) { logger.LogError( (int)ErrorCode.Catalog_SiloStatusChangeNotification_Exception, exc, "Catalog has thrown an exception while handling removal of silo {Silo}", updatedSilo.ToStringWithHashCode()); } } } logger.LogInformation( (int)ErrorCode.Catalog_SiloStatusChangeNotification, "Catalog is deactivating {Count} activations due to a failure of silo {Silo}, since it is a primary directory partition to these grain ids.", activationsToShutdown.Count, updatedSilo.ToStringWithHashCode()); } finally { // outside the lock. if (activationsToShutdown.Count > 0) { var reasonText = $"This activation is being deactivated due to a failure of server {updatedSilo}, since it was responsible for this activation's grain directory registration."; var reason = new DeactivationReason(DeactivationReasonCode.InternalFailure, reasonText); StartDeactivatingActivations(reason, activationsToShutdown); } } }
public override void OnDeactivated(DeactivationReason reason) { }
// This gets called when the NFC reader is offline, or communicating // with another application public override void OnDeactivated(DeactivationReason reason) { throw new NotImplementedException(); }
protected override void WhenGestureDeactivated(Hand maybeNullLeftHand, Hand maybeNullRightHand, DeactivationReason reason) { lr.enabled = false; //turn on or off the line renderer based on double gasp status scaleIconParent.gameObject.SetActive(false); playFeedback(reason); }
public void OnDeactivated(DeactivationReason reason) { SaveAppState(); }
public override async Task OnDeactivateAsync(DeactivationReason reason, CancellationToken cancellationToken) { _logger.LogInformation("OnDeactivateAsync"); await base.OnDeactivateAsync(reason, cancellationToken); }
public override void OnDeactivated (DeactivationReason reason) { }
public override Task OnDeactivateAsync(DeactivationReason reason, CancellationToken cancellationToken) { logger.Info("OnDeactivateAsync"); return(base.OnDeactivateAsync(reason, cancellationToken)); }
public Task OnDeactivateAsync(DeactivationReason deactivationReason, CancellationToken cancellationToken) { this.logger.LogDebug("***Deactivating*** {0}", this.GetPrimaryKey()); return(Task.CompletedTask); }
public override Task OnDeactivateAsync(DeactivationReason reason, CancellationToken cancellationToken) { _logger.LogInformation("OnDeactivateAsync"); return(Task.CompletedTask); }
// This gets called when the NFC reader is offline, or communicating // with another application public override void OnDeactivated (DeactivationReason reason) { throw new NotImplementedException (); }