private void stage_Unloaded(object sender, RoutedEventArgs e) { #if !NoHardware Activity activity = new Activity(parameterManager); if (activity.IsActive) { activity.Abort(); WriteLine(Properties.Strings.ActivityAbort); } #endif Surface surface = Surface.GetInstance(parameterManager); surface.OnMotorBottomLimited -= surfaceOnMotorBottom_Limited; surface.LowBottomRecognized -= surfaceLowBottom_Recognized; surface.LowTopRecognized -= surfaceLowTop_Recognized; surface.UpBottomRecognized -= surfaceUpBottom_Recognized; surface.UpTopRecognized -= surfaceUpTop_Recognized; surface.Exited -= surface_Exited; GridMarkSearch gs = GridMarkSearch.GetInstance(coordManager, parameterManager); gs.Started -= gridMark_Started; gs.Found -= gridMark_Found; gs.Exited -= gridMark_Exited; }
protected virtual void KeyHandleWorkspace_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (!IsControllable) { WriteLine(Properties.Strings.NoControllable); return; } // アクティビティが実行中であれば中止する. Activity activity = new Activity(parameterManager); activity.Abort(); // モータが移動中であれば移動を中止する. MotorControler mc = MotorControler.GetInstance(parameterManager); if (mc.IsMoving) { mc.AbortMoving(); WriteLine(Properties.Strings.AbortMotor); } try { #if !_NoHardWare if (e.Key == Key.A) { mc.ContinuousDrive(VectorId.X, PlusMinus.Minus, mc.Speed.X); } else if (e.Key == Key.D) { mc.ContinuousDrive(VectorId.X, PlusMinus.Plus, mc.Speed.X); } else if (e.Key == Key.X) { mc.ContinuousDrive(VectorId.Y, PlusMinus.Minus, mc.Speed.Y); } else if (e.Key == Key.W) { mc.ContinuousDrive(VectorId.Y, PlusMinus.Plus, mc.Speed.Y); } else if (e.Key == Key.Q) { mc.ContinuousDrive(VectorId.Z, PlusMinus.Minus, mc.Speed.Z); } else if (e.Key == Key.E) { mc.ContinuousDrive(VectorId.Z, PlusMinus.Plus, mc.Speed.Z); } else if (e.Key == Key.N) { mc.MoveInSpiral(); } else if (e.Key == Key.O) { mc.SetSpiralCenterPoint(); } else if (e.Key == Key.I) { mc.BackToSpiralCenter(); } else if (e.Key == Key.B) { mc.SpiralBack(); } #endif } catch (MotorException ex) { WriteLine(ex.Message); } }