public void ValueChanged(int linkId, bool value) { DispatcherHelperEx.CheckBeginInvokeOnUI(() => { Messenger.Default.Send(new UpdateTwoPositionLinkStateMessage(linkId, value)); }); }
private void OnStepCompleteMessage(StepCompleteMessage msg) { if (_autoStepOver) { if (_multiChannel) { OnStepCompleteMessageMultiChannel(msg); } else { Task.Run(async() => { await Task.Delay(50); StepViewModel newSelection = GetNextStep(); if (newSelection != null) { DispatcherHelperEx.CheckBeginInvokeOnUI(() => Selected = newSelection); } //if (newSelection != null) Selected = newSelection; }); } } }
private static void EvaluateMaterialRemovalEvo(DateTime now) { if (EnableMaterialRemoval) { if (!_removalTaskActive) { Task.Run(() => { _removalTaskActive = true; while (true) { if (Interlocked.CompareExchange(ref _pendingMovement, 0, 1) == 1) { DispatcherHelperEx.CheckBeginInvokeOnUI(() => { Messenger.Default.Send(new GetPanelTransformMessage() { SetData = (b, t) => { //if (b) EvaluateMaterialRemovalForRoutTool(t); if (b) { EvaluateMaterialRemovalForTool(t); } } }); }); } else { _removalTaskManualResetEvent.Wait(); _removalTaskManualResetEvent.Reset(); } if (!EnableMaterialRemoval) { break; } } _removalTaskActive = false; }); } else { _removalTaskManualResetEvent.Set(); } //Messenger.Default.Send(new ProcessPendingRemovalMessage()); _materialRemovalMessageSender.SendProcessPendingRemovalMessage(); } else { if (!_removalTaskManualResetEvent.IsSet) { _removalTaskManualResetEvent.Set(); } } }
public void ValueChanged(int linkId, double value) { DispatcherHelperEx.CheckBeginInvokeOnUI(() => { Messenger.Default.Send(new UpdateLinearLinkStateMessage(linkId, value)); }); }
private void OnGetActiveToolMessage(GetActiveToolMessage msg) { if (ActiveTool) { DispatcherHelperEx.CheckBeginInvokeOnUI(() => { var t = this.GetChainTansform(); var p = t.Transform(Position); var v = t.Transform(Direction); msg.SetData(p, v, _tool); }); } }
protected override void OnProcessPendingRemovalMessage(ProcessPendingRemovalMessage msg) { _safeSideMeshData.ExeAndReset((positions, triangleIndices, normals) => { DispatcherHelperEx.CheckBeginInvokeOnUI(() => { _sideGeometry = new MeshGeometry3D() { Positions = positions, TriangleIndices = new IntCollection(triangleIndices), Normals = normals }; }); }); base.OnProcessPendingRemovalMessage(msg); }
private static void EvaluateItems(DateTime now) { lock (_lockObj1) { if (_items.Count > 0) { Interlocked.Exchange(ref _pendingMovement, 1); } _items.ForEach(i => { i.Progress(now); DispatcherHelperEx.CheckBeginInvokeOnUI(() => { Messenger.Default.Send(new UpdateLinearLinkStateToTargetMessage(i.LinkId, i.ActualValue, i.IsCompleted)); }); }); _items = _items.Where((ii) => !ii.IsCompleted).ToList(); } }
private static void EvaluateGroups(DateTime now) { lock (_lockObj2) { if (_itemsGroups.Count > 0) { Interlocked.Exchange(ref _pendingMovement, 1); } foreach (var ig in _itemsGroups.Values) { ig.Progress(now); DispatcherHelperEx.CheckBeginInvokeOnUI(() => { ig.Items.ForEach((i) => Messenger.Default.Send(new UpdateLinearLinkStateToTargetMessage(i.LinkId, i.ActualValue, ig.IsCompleted))); }); } _itemsGroups = _itemsGroups.Where(ig => !ig.Value.IsCompleted).ToDictionary(kp => kp.Key, kp => kp.Value); } }
private void OnStepCompleteMessageMultiChannel(StepCompleteMessage msg) { Task.Run(async() => { await Task.Delay(50); if (msg.Channel > 0) { var step = GetNextStep(msg.Channel, msg.Index); if (_channelState.AddOrUpdate(msg.Channel, step != null, (k, v) => step != null)) { step.UpdateLazys(); step.ExecuteFarward(); } else { if (_channelFreeBackNotifyId.TryRemove(msg.Channel, out int id)) { MessengerInstance.Send(new MeVmMG.BackNotificationMessage() { DestinationId = id }); } } } else { StepViewModel newSelection = GetNextStep(); if (newSelection != null) { DispatcherHelperEx.CheckBeginInvokeOnUI(() => Selected = newSelection); } } }); }
private void OnGetActiveRoutToolMessage(GetActiveRoutToolMessage msg) { if (ActiveTool && (_tool != null)) { DispatcherHelperEx.CheckBeginInvokeOnUI(() => { if (_chainTransform == null) { _chainTransform = this.GetChainTansform(); } var t = _chainTransform.Value; Task.Run(() => { if (_tool.ToolType == TME.ToolType.AngularTransmission) { var at = _tool as AngolarTransmission; foreach (var item in at.Subspindles) { var p = t.Transform(Position + item.Position.ToVector3D()); var v = t.Transform(item.Direction.ToVector3D()); msg.SetData(p, v, item.Tool, ToolHolderId); } } else { var p = t.Transform(Position); var v = t.Transform(Direction); msg.SetData(p, v, _tool, ToolHolderId); } }); }); } }