c# - WPF Task on Touch device not back properly to UI Thread -
i have wpf application background tasks done works on laptop not working fine in tablet windows 7.
you click screen, loading image shown while background job done, , @ end of job dialog info shown. press button on dialog , go main screen.
in tablet @ end when dialog shown have press screen once have gui "active" , again application detect click. ui thread gets "disabled" after background task , needs screen touch active again. quite annoying because user has press multiple times button action performed. behaviour happens in tablet, not on laptop...
here code:
public void processtouch(point p) { task getpendingdocstask = task.factory.startnew(getpendingdocs, cancellationtoken.none, taskcreationoptions.none, taskscheduler.default); task aftergetpentingdocstask = getpendingdocstask.continuewith(w => aftergetpendingdocs(), taskscheduler.fromcurrentsynchronizationcontext()); } private void getpendingdocs() { thread.sleep(500); } private void aftergetpendingdocs() { mainprogresscircle.visibility = system.windows.visibility.hidden; this.background = (brush)bc.convertfrom("#013857"); windowdialog adialog = new windowdialog(this); adialog.showdialog(); }
in dialog function when click is:
private void button_click(object sender, routedeventargs e) { this.close(); }
and xaml of button on dialog
<s:surfacebutton margin="-4" borderbrush="transparent" borderthickness="0" width="200" height="75" horizontalalignment="center" name="openbutton" horizontalcontentalignment="center" verticalcontentalignment="center" fontfamily="tahoma" fontsize="20" content="aceptar" background="#78b41e" foreground="white" click="button_click" ismanipulationenabled="true" />
i have tried backgroundworker , dispatcher , behaviour same. works on regular computer not response fine on windows 7 touch device.
any clue wellcomed.
thanks in advance, ivan.
Comments
Post a Comment