protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); RotationImage image = (RotationImage)sender; newRotation = (float)image.NextRotation; if (Control != null) { Animate(0.5, () => { nfloat angle = (nfloat)((newRotation * Math.PI) / 180); Transform = CGAffineTransform.MakeRotation(angle); }); } }
// 删除 public IActionResult DeleteRotationImages(int?code) { var Aid = HttpContext.Session.GetString("Aid"); if (Aid == null) { return(RedirectToAction("Login", "Login")); } if (code == null) { return(Content("500")); } RotationImage rotationImage = _context.RotationImage.FirstOrDefault(u => u.RotationImageCode == code); _context.RotationImage.Remove(rotationImage); _context.SaveChanges(); return(Content("200")); }
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); RotationImage image = (RotationImage)sender; float newRotation = (float)(image.NextRotation % 360); if (Control != null) { RotateAnimation animation = new RotateAnimation((float)currentDegree, (float)newRotation, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); animation.Duration = 250; animation.FillAfter = true; Control.StartAnimation(animation); currentDegree = (float)newRotation; } }
//添加动作 public async Task <IActionResult> RotationImagesCreates(string RotationImagesUrl, string RotationImagesJumpUrl) { var Aid = HttpContext.Session.GetString("Aid"); if (Aid == null) { return(RedirectToAction("Login", "Login")); } if (RotationImagesUrl != null) { if (_context.RotationImage.Where(a => a.RotationImageUrl == RotationImagesUrl).Count() == 0) { if (_context.RotationImage.Where(a => a.RotationImageJumpUrl == RotationImagesJumpUrl).Count() == 0) { try { var rotationImage = new RotationImage { RotationImageUrl = RotationImagesUrl, RotationImageJumpUrl = RotationImagesJumpUrl, }; _context.Add(rotationImage); await _context.SaveChangesAsync(); return(Content("200")); } catch (DbUpdateConcurrencyException) { return(Content("404")); } } else { return(Content("201")); } } else { return(Content("201")); } } return(Content("500")); }