我需要一些非常准确的方法来确定表面刻度旋转结束时:
private void OnRotationChanged(RadialController sender, RadialControllerRotationChangedEventArgs args)
{
double angle = args.RotationDeltaInDegrees;
}
我真的迷失了如何在旋转结束时以超精确的方式确定 .
这是我的第一次尝试,但工作超级飘忽不定 .
bool start = true;
private void OnRotationChanged(RadialController sender, RadialControllerRotationChangedEventArgs args)
{
if (start == true)
{
start = false;
//send mouse left down event relative to mouse position
VirtualMouse.LeftDown(0, 0);
}
if (timer != null)
{
timer.Tick -= timer_Tick;
}
timer = new DispatcherTimer { Interval = TimeSpan.FromMillisecond(10) };
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
if (args.RotationDeltaInDegrees > 0)
{
//move mouse 1 pixel + Y relative to mouse postion
VirtualMouse.Move(0, 1);
}
else
{
//move mouse 1 pixel - Y relative to mouse postion
VirtualMouse.LeftDown(0, -1);
}
}
void timer_Tick(object sender, EventArgs e)
{
start = true;
//release the left mouse down relative to mouse position
VirtualMouse.LeftUp(0, 0);
}
当我说准确时,我指的是在任何情况下都要检测的某种方式 . 例如,如果您旋转缓慢并且计时器大约1毫秒,则拨号(旋转缓慢)的每个新事件都不会及时到达取消挂钩 . 如果我在非准确的过程中增加定时器的所有整个检测结果,增加了非期望的延迟 . 我知道这不是要走的路,只是测试,但不知道如何在旋转拨盘慢的情况下实现正确的检测,或者更快以获得真正的指示器旋转或旋转拨号停止 .
确定何时旋转开始是蛋糕,但旋转结束?
表面刻度盘可提供0.1度的精度,是真正精确的光学器件 . 因此,一个完整的旋转能够提供3600个事件/角度报告 .
......不知道,思考和思考 .