c# - How to create a dialog result in maham? -
i'm trying create code show dialog result:
var result = this.showmessageasync("proceed?", "info", messagedialogstyle.affirmativeandnegative); if (result == messagedialogresult.affirmative) { this.hide(); } but compiler on line if (result == messagedialogresult.affirmative), show me message:
you can not apply == operator operands of type 'task ' , 'messagedialogresult'
in example used operator, doing wrong?
showmessageasync() seems asyncronous method, meaning returns task<t> instead of t.
so can either await task this:
var result = await this.showmessageasync("proceed?", "info", messagedialogstyle.affirmativeandnegative); or can result of it:
var result = this.showmessageasync("proceed?", "info", messagedialogstyle.affirmativeandnegative) .result; not if want await task, must in method marked async
Comments
Post a Comment