这是一个简单的问题,但我无法弄清楚。
我在[AllowAnonymous]
Public ActionResult ConfirmEmail(string userId, string code)
{
if(userId == null || code == null)
{
return View("Error");
}
var user = UserManager.FindById(userId);
if(user == null)
{
}
else
{
RunAsync(ForceResetPassword(user));
return RedirectToAction("ResetPasswordAfterConfirmation","Account");
}
}
Public async Task<ActionResult> ForceResetPassword(ApplicationUser user)
{
string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);
var callbackUrl = Url.Action("Reset Password", "Account", new {userId = user.Id, code = code}, protocol: Request.Url.Scheme);
await UserManager.SendEmailAsync(user.Id,"Reset Password","Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>");
//Insert send email code here
}
private void RunAsync(Task task)
{
task.ContinueWith(t =>
{
}, TaskContinuationOptions.OnlyOnFaulted);
}
中有一个名为NSWindowController
的类的自定义NSView:
MyView
在我的NSWindowController(类名为MainWindowController)中,我有 导入Cocoa
import Cocoa
class MyView: NSView {
func doNothing () {
NSColor.green.set()
}
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
}
}
并class MainWindowController: NSWindowController {
@IBOutlet weak var mapaView: MyView!
override var windowNibName: String {
return "MainWindowController"
}
override func windowDidLoad() {
super.windowDidLoad()
window?.contentAspectRatio = mapaView.frame.size
}
@IBAction func aver(_ sender: AnyObject) {
mapaView.frame = CGRect(x: 10.0, y: 10.0, width: 30.0, height: 50.00)
mapaView.doNothing()
}
}
与NSButton
IBAction aver()
相关联
当我点击按钮时,MainWindowController
中的框架会发生变化,mapaView
会因mapaView.doNothing()
而崩溃
我做错了什么?