private void DrawLeftTimeBar(SKCanvas Canvas) { var LeftTimeBarRect = new SKRect ( CanvasRect.Left, CanvasRect.Top, CanvasRect.Right, CanvasRect.Top + (LeftTimeBarHeight * PhysicalPixelRate) ); using (var paint = new SKPaint()) { if (default(DateTime) != base.LastPublicActivity) { paint.Color = AlphaDomain.MakeLeftTimeColor(LeftTime).ToSKColor(); } else { paint.Color = AlphaDomain.GetElapsedTimeColor().ToSKColor(); } Canvas.DrawRect ( LeftTimeBarRect, paint ); } using (var paint = new SKPaint()) { paint.IsAntialias = true; paint.Color = BackgroundColor.ToSKColor(); paint.StrokeCap = SKStrokeCap.Round; paint.TextSize = FontSize * PhysicalPixelRate; paint.TextAlign = SKTextAlign.Center; paint.Typeface = Font; var LeftTimeBarText = ""; if (default(DateTime) != base.LastPublicActivity) { LeftTimeBarText = L["Left Time"] + " : " + Domain.ToString(LeftTime); } else if (string.IsNullOrWhiteSpace(User)) { LeftTimeBarText = L["Please specify GitHub user."]; } Canvas.DrawText ( LeftTimeBarText, LeftTimeBarRect.MidX, LeftTimeBarRect.MidY + (paint.TextSize / 2.0f), paint ); paint.Typeface = null; } }
public void UpdateSlices() { SetStartAngle(AlphaDomain.TimeToAngle(Now)); if (default(DateTime) != base.LastPublicActivity) { var Today = Now.Date; var LeftTimeColor = AlphaDomain.MakeLeftTimeColor(LeftTime); AltTextColor = LeftTimeColor; Data = AlphaDomain.MakeSlices(LeftTime, LeftTimeColor); if (!IsVisibleSatelliteTexts || GraphSize < FontSize * 6.0f) { SatelliteTexts = null; } else if (GraphSize < FontSize * 9.0f) { SatelliteTexts = AlphaDomain.MakeSatelliteTexts(Now, LastPublicActivity, 6); } else if (GraphSize < FontSize * 12.0f) { SatelliteTexts = AlphaDomain.MakeSatelliteTexts(Now, LastPublicActivity, 3); } else { SatelliteTexts = AlphaDomain.MakeSatelliteTexts(Now, LastPublicActivity); } //Task.Run(() => Domain.AutoUpdateLastPublicActivityAsync()); } else { AltTextColor = Color.Gray; Data = AlphaDomain.MakeSlices(TimeSpan.Zero, Color.Lime); if (!IsVisibleSatelliteTexts) { SatelliteTexts = null; } else { SatelliteTexts = Enumerable.Range(0, 24).Select ( i => new CircleGraphSatelliteText { Text = i.ToString(), Color = Color.Gray, Angle = 360.0f * ((float)(i) / 24.0f), } ); } } }
protected void UpdateLeftTime(DateTime Now, DateTime LastPublicActivity) { if (default(DateTime) != LastPublicActivity) { var Today = Now.Date; var LimitTime = LastPublicActivity.AddHours(24); var LeftTime = LimitTime - Now; LeftTimeLabel.Text = Domain.ToString(LeftTime); LeftTimeLabel.TextColor = AlphaDomain.MakeLeftTimeColor(LeftTime); Task.Run(() => Domain.AutoUpdateLastPublicActivityAsync()); } else { LeftTimeLabel.Text = ""; /*if (Settings.IsValidUserName) * { * StopUpdateLeftTimeTask(); * }*/ } //Debug.WriteLine("AlphaDetailPage::UpdateLeftTime::LeftTime = " +LeftTimeLabel.Text); }