i feel bit out of depths this.
i have seperate timer thread ticks once second. if value hits <= 0, bit of code run:
... enemyhp = enemymaxhp; //toast t = new toast("you died!", "oh no, died! " + enemies[currentenemy].name + " killed you, , lost " + lost + " gp!", notificationtype.warning); log.info("player died!!! enemy responsible: " + enemies[currentenemy].name + ". gp lost: " + lost + "."); if run is, log.info line run, , log line appears in file. if, however, uncomment middle line, starts run that, seems stop , never runs logfile line. here ctor in toast upon calling:
public toast(string title, string description, notificationtype type = notificationtype.information) { toast = new toastpopup(title, description, "", type); toast.background = new solidcolorbrush(colors.aliceblue); toast.borderbrush = new solidcolorbrush(colors.black); toast.fontcolor = new solidcolorbrush(colors.black); //toast.hyperlinkclicked += this.toasthyperlinkclicked; //toast.closedbyuser += this.toastclosedbyuser; toast.show(); } toastpopup refers https://toastspopuphelpballoon.codeplex.com/ - using this. toast popup not show when run through code, runs fine when using identical code elsewhere in code.
i suspect toast can created ui thread, constructor throws exception. ui operations in wpf can done ui thread, rule.
try invoke toast constructor on ui thread. assumes application wpf app (that not 100% clear question).
you should learn how handle exceptions in non-ui threads in wpf, can see why code breaking.
Comments
Post a Comment