public void StopPlaying() { if (isPlaying) { StopEvent?.Invoke(); SetPlayState(false); } }
public void Stop() { if (!IsRunning) { return; } _isRunning = false; StopEvent?.Invoke(this, EventArgs.Empty); }
public void Rotate(Vector3 v, float deltaTime, bool active = false) { var speed = acceleration.GetSpeed(deltaTime, rotationSpeed, active); movement.Rotate(v * speed); if (previousRotationSpeed < 0.1f && speed != previousRotationSpeed) { RotateEvent?.Invoke(); } else if (previousRotationSpeed > 0.1f && speed == 0) { StopEvent?.Invoke(); } previousRotationSpeed = speed; }
public void LookRotate(Vector3 v, float deltaTime, bool active = false) { var speed = acceleration.GetSpeed(deltaTime, rotationSpeed, active); currentLookRotation = Vector3.Lerp(currentLookRotation, v, speed); movement.LookRotate(currentLookRotation); if (previousLookRotationSpeed < 0.1f && speed != previousLookRotationSpeed) { RotateEvent?.Invoke(); } else if (previousLookRotationSpeed > 0.1f && speed == 0) { StopEvent?.Invoke(); } previousLookRotationSpeed = speed; }
/// <summary> /// 停止按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void stop_Click(object sender, EventArgs e) { if (running)//运行中 { StopEvent?.Invoke(); running = false; pausing = false; Start.Enabled = true; pause.Enabled = true; resume.Enabled = true; stop.Enabled = true; SelectMethod.Enabled = true; } else { return; } }
// Старт процесса в режиме удаленного управления public async Task RemoteStart(IDevice device, string box, DateTime dateTime, bool primaryVerification) { try { Product = new ProductInfo(device, box, dateTime, primaryVerification); RemoteStartEvent?.Invoke(this, new EventArgs()); cts = new CancellationTokenSource(); await Task.Run(() => Start(device, primaryVerification, cts.Token)); savingResults.SaveResult(Product, TestResults, dialogService); StopEvent?.Invoke(this, new EventArgs()); ProcessComplete?.Invoke(this, new EventArgs()); } catch (OperationCanceledException) { StopEvent?.Invoke(this, new EventArgs()); } }
public static void RecordPath() { m_RecordPath = true; double lastSplitX = -1; double lastSplitY = -1; while (m_RecordPath) { Api.Sync.WaitOne(); if (Api.PlayerData.Found) { double currentX = Api.PlayerData.PlayerXPosition; double currentY = Api.PlayerData.PlayerYPosition; uint currentMapId = Api.PlayerData.MapId; if (lastSplitX == -1) { lastSplitX = currentX; lastSplitY = currentY; RecordPathEvent?.Invoke(null, new RecordPathEventArgs(new Waypoint(currentMapId, currentX, currentY))); continue; } double splitDistance = Math.Sqrt((currentX - lastSplitX) * (currentX - lastSplitX) + (currentY - lastSplitY) * (currentY - lastSplitY)); if (splitDistance < SplitDistance) { continue; } lastSplitX = currentX; lastSplitY = currentY; RecordPathEvent?.Invoke(null, new RecordPathEventArgs(new Waypoint(currentMapId, currentX, currentY))); } } StopEvent?.Invoke(null, new EventArgs()); }
/// <summary> /// 终止运行 /// </summary> public void ThreadStop() { //置位退出标志 stop = true; //检测是否在暂停中 if (on_off) { ThreadResume(); } do { Thread.Sleep(100); }while(thread.IsAlive); //清除标志位 on_off = false; stop = false; //加工结束 响应的动作 StopEvent?.Invoke(); }
void Start() { StartEvent.Invoke(); UpdateEvent.Invoke(); StopEvent.Invoke(); }
public void Update(GameTime gameTime, bool enableMove) { if (_isActive && enableMove) { Vector3 translateScaleLocal = Vector3.Zero; Vector3 translateScaleWorld = Vector3.Zero; Matrix rotationLocal = Matrix.Identity; Matrix rotationWorld = Matrix.Identity; if (_mouse.IsMouseButtonDown(Input.MouseButton.Left) && ActiveAxis != GizmoAxis.None) { if (_mouse.LastState().LeftButton == ButtonState.Released) { StartEvent?.Invoke(); } switch (ActiveMode) { case GizmoMode.UniformScale: case GizmoMode.NonUniformScale: case GizmoMode.Translate: HandleTranslateAndScale(_mouse.Position(), out translateScaleLocal, out translateScaleWorld); break; case GizmoMode.Rotate: HandleRotation(gameTime, out rotationLocal, out rotationWorld); break; } } else { if (_mouse.LastState().LeftButton == ButtonState.Pressed && _mouse.State().LeftButton == ButtonState.Released) { StopEvent?.Invoke(); } ResetDeltas(); if (_mouse.State().LeftButton == ButtonState.Released && _mouse.State().RightButton == ButtonState.Released) { SelectAxis(_mouse.Position()); } } UpdateGizmoPosition(); // -- Trigger Translation, Rotation & Scale events -- // if (_mouse.IsMouseButtonDown(Input.MouseButton.Left)) { if (translateScaleWorld != Vector3.Zero) { if (ActiveMode == GizmoMode.Translate) { foreach (var entity in Selection) { OnTranslateEvent(entity, translateScaleWorld, translateScaleLocal); } } else { foreach (var entity in Selection) { OnScaleEvent(entity, translateScaleWorld); } } } if (rotationWorld != Matrix.Identity) { foreach (var entity in Selection) { OnRotateEvent(entity, rotationWorld, rotationLocal); } } } } if (Selection.Count == 0) { _isActive = false; ActiveAxis = GizmoAxis.None; return; } // helps solve visual lag (1-frame-lag) after selecting a new entity if (!_isActive) { UpdateGizmoPosition(); } _isActive = true; // -- Scale Gizmo to fit on-screen -- // Vector3 vLength = _camera.Position - _position; const float scaleFactor = 25; _screenScale = vLength.Length() / scaleFactor; var screenScaleMatrix = Matrix.CreateScale(new Vector3(_screenScale * ScaleModifier)); _localForward = Vector3.Transform(Vector3.Forward, Matrix.CreateFromQuaternion(Selection[0].Orientation)); //Selection[0].Forward; _localUp = Vector3.Transform(Vector3.Up, Matrix.CreateFromQuaternion(Selection[0].Orientation)); //Selection[0].Up; // -- Vector Rotation (Local/World) -- // _localForward.Normalize(); _localRight = Vector3.Cross(_localForward, _localUp); _localUp = Vector3.Cross(_localRight, _localForward); _localRight.Normalize(); _localUp.Normalize(); // -- Create Both World Matrices -- // _objectOrientedWorld = screenScaleMatrix * Matrix.CreateWorld(_position, _localForward, _localUp); _axisAlignedWorld = screenScaleMatrix * Matrix.CreateWorld(_position, SceneWorld.Forward, SceneWorld.Up); // Assign World if (GizmoDisplaySpace == TransformSpace.World || //ActiveMode == GizmoMode.Rotate || //ActiveMode == GizmoMode.NonUniformScale || ActiveMode == GizmoMode.UniformScale) { _gizmoWorld = _axisAlignedWorld; // align lines, boxes etc. with the grid-lines _rotationMatrix.Forward = SceneWorld.Forward; _rotationMatrix.Up = SceneWorld.Up; _rotationMatrix.Right = SceneWorld.Right; } else { _gizmoWorld = _objectOrientedWorld; // align lines, boxes etc. with the selected object _rotationMatrix.Forward = _localForward; _rotationMatrix.Up = _localUp; _rotationMatrix.Right = _localRight; } // -- Reset Colors to default -- // ApplyColor(GizmoAxis.X, _axisColors[0]); ApplyColor(GizmoAxis.Y, _axisColors[1]); ApplyColor(GizmoAxis.Z, _axisColors[2]); // -- Apply Highlight -- // ApplyColor(ActiveAxis, _highlightColor); }
protected void OnStop() { StopEvent?.Invoke(this); }
private void Button_Click_1(object sender, RoutedEventArgs e) { StopEvent.Invoke(sender, e); }
private void stopToolStripMenuItem_Click(object sender, EventArgs e) { StopEvent?.Invoke(this, e); }
protected virtual void OnStopEvent() { StopEvent?.Invoke(this, EventArgs.Empty); }
private static void Shutdown() { StopEvent?.Invoke(); Bootstrap.Dispose(); }
/// <summary> /// Mark坐标定位 试矫正 /// </summary> private void Mark_AFF_Correction() { if (Calibration.Calibrate_Mark(0)) { //解析DXF文件 ResolveData(); //判断是否存在加工轨迹偏移轨迹 if (File_Entity_Datas.LayerSectionDatas.Count <= 0) { StopEvent?.Invoke(); return; } //Mark定位 检测是否Mark是否在相机视野 //重新梳理定位Mark信息 if (MarkType == 1) // 1 - 整块板定位(取4角) { File_Entity_Datas.PlatformMarkInfo.Clear(); //清空平台Mark坐标 foreach (var o in File_Entity_Datas.DxfMarkInfo) { File_Entity_Datas.PlatformMarkInfo.Add(new Vector(o.X + File_Entity_Datas.Mark.X, o.Y + File_Entity_Datas.Mark.Y)); } } else if (MarkType == 2)// 2 - 阵列文件定位(小分区取4角); { for (int i = 0; i < File_Entity_Datas.LayerSectionDatas.Count; i++) { for (int j = 0; j < File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas.Count; j++) { File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].PlatformMarkInfo.Clear();//清空平台Mark坐标 foreach (var o in File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].DxfMarkInfo) { File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].PlatformMarkInfo.Add(new Vector(o.X + File_Entity_Datas.Mark.X, o.Y + File_Entity_Datas.Mark.Y)); } } } } //验证视野是否存在Mark图形 if (MarkType == 1)// 1 - 整块板定位(取4角) { //Mark点位数量异常 if ((File_Entity_Datas.PlatformMarkInfo.Count < 3) || (File_Entity_Datas.DxfMarkInfo.Count < 3)) { MessageBox.Show("Mark定位点位数据异常!!!"); return; } //验证 for (int i = 0; i < File_Entity_Datas.PlatformMarkInfo.Count; i++) { //定位到Mark点 Program.SystemContainer.GTS_Fun.Gts_Ready_Correct(File_Entity_Datas.PlatformMarkInfo[i]); //调用相机,获取对比的坐标信息 Thread.Sleep(50); //延时50ms Cam = new Vector(Program.SystemContainer.T_Client.Get_Cam_Deviation_Coordinate_Correct(Program.SystemContainer.SysPara.Camera_Mark_Type)); //触发拍照 if (Cam.Length == 0) { MessageBox.Show("相机坐标提取失败,请检查!!!"); return(null); } } } else if (MarkType == 2)// 2 - 阵列文件定位(小分区取4角); { //处理数据 for (int i = 0; i < File_Entity_Datas.LayerSectionDatas.Count; i++) { for (int j = 0; j < File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas.Count; j++) { //验证 } } } appendInfo("Mark点矫正完成!!!"); return; } else { appendInfo("Mark点矫正失败!!!"); return; } }
/// <summary> /// 循环结构 /// </summary> public void Runtime() { /****************启动前检测***************/ //判断坐标系建立是否破坏 if ((Program.SystemContainer.IO.Axis01_mode != 5) || (Program.SystemContainer.IO.Axis01_mode != 5)) { Info("检测到平台坐标系未建立,请重新回零!!!"); //非强制退出 if (!stop) { //加工结束 响应的动作 StopEvent?.Invoke(); } return; } /****************加工方式选择***************/ //选择加工方式 this.Invoke((EventHandler) delegate { Work_Type_No = Array.IndexOf(Methods_List, Work_Type_Select_List.SelectedItem.ToString()); }); switch (Work_Type_No) { case 0: //振镜空白和平台未补偿 break; case 1: //振镜仿射和平台未补偿 break; case 2: //振镜仿射和平台已补偿 //解析DXF文件 ResolveData(); //判断是否存在加工轨迹偏移轨迹 if (File_Entity_Datas.LayerSectionDatas.Count <= 0) { StopEvent?.Invoke(); return; } //Mark定位 矫正偏转 if (!CalibrateFileData(File_Entity_Datas)) { StopEvent?.Invoke(); return; } //加工指定文件 PushDataToController(File_Entity_Datas); //从这里指定加判断 break; case 3: //振镜旋转和平台已补偿 break; case 4: //振镜矩阵和平台已补偿 break; case 5: //振镜桶形畸变图形加工 Rtc_Barrel_Distortion_Figure_Sculpture(); break; case 6: //振镜桶形畸变数据采集 Rtc_Barrel_Distortion_Figure_Data_Acquisition(); break; case 7: //振镜仿射矩阵图形加工 break; case 8: //振镜仿射矩阵数据采集 break; case 9: //Mark坐标定位矫正 Mark_AFF_Correction(); break; case 10: //Mark坐标定位重矫正 移除,不再使用 break; case 11: //相机坐标系标定(打标) Calibration_Camera_Axes_Mark(); break; case 12: //相机坐标系标定(标定板) Calibration_Camera_Axes_Board(); break; case 13: //矫正振镜坐标系偏转角 Calibration_Rtc_Axes_AFF_Angle(); break; case 14: //振镜与ORG距离校准 Calibration_Rtc_Gts_ORG_Distance(); break; case 15: //坐标系原点坐标校准 Clabration_ORG_Align(); break; case 16: //计算标定板旋转参数 Calibration_Board_Angle(); break; case 17: //标定板原始校准数据 Calibration_Original_Data_Collect(); break; case 18: //标定板二次校准验证 Calibration_Second_Data_Collect(); break; case 19: //振镜空白和平台已补偿 break; case 20: //标定板多次校准验证 break; default: break; } /************非强制退出************/ //非强制退出 if (!stop) { //加工结束 响应的动作 StopEvent?.Invoke(); } }
private void StopButtonClicked(object sender, RoutedEventArgs e) { StopEvent.Invoke(sender, e); }
public void StopGame() { _score.TrySaveBest(_player); StopEvent?.Invoke(); }