/// <summary> /// Shows the actual and tapped dots in the playground /// </summary> /// <param name="point"></param> /// <param name="acc"></param> private void UpdatePlayGround(Point point, TapPrecisionModel acc) { PositionVisiblity = true; UserTapPrecisionData.Add(acc); ActualX = acc.ActualXPosition * XPlay; ActualY = acc.ActualYPosition * YPlay; UserX = point.X; UserY = point.Y; }
/// <summary> /// Calculates the precison accuaracy as well as the error /// </summary> /// <param name="point"></param> /// <returns></returns> private TapPrecisionModel CalculateAccuracy(Point point) { TapPrecisionModel res = new TapPrecisionModel(); if (XTop != -1 && XPlay != -1 && YTop != -1 && YPlay != -1) { res.ActualXPosition = XLocationFactor / XTop; res.ActualYPosition = YLocationFactor / YTop; res.UserXError = Math.Abs((point.X / XPlay) - res.ActualXPosition) * 100; res.UserYError = Math.Abs((point.Y / YPlay) - res.ActualYPosition) * 100; /////Some logic needed to find out the percentage accuracy from this variance } return(res); }
/// <summary> /// Checks and displays popup of the precision of users tap /// </summary> /// <param name="point"></param> /// <returns></returns> private async System.Threading.Tasks.Task CheckPrecisionAsync(Point point) { if (!IsStatVisible) { TapPrecisionModel acc = CalculateAccuracy(point); UpdatePlayGround(point, acc); var totalAcc = (100 - (acc.UserXError + acc.UserYError)); //TODO this popup has to be something else (say a nicer custom view) var choice = await _navService.ShowInteractiveDialogAsync("Accuracy", "Your accuracy is : " + totalAcc.ToString("#.000"), "Play More", "Stats"); if (choice) { UpdateDotLocation(); PositionVisiblity = false; } else { showStat(); } } }