wpf - DispatchHelper open new window -
i using dispatchhelper mvvm light open new window while calculation being performed. window contains simple label , button. when use show() method window appear when calculation starts , close when calculation ends label , button not in window.
i have tried using showdialog() method before calculation starts , show label , button on window. however, showdialog doesn't return until window gets closed. therefore, window stay open , calculation not performed.
would have advise on how work through issue?
public relaycommand showpopupcontrol { { return _showpopupcontrol ?? (_showpopupcontrol = new relaycommand( () => { dispatcherhelper.checkbegininvokeonui(() => { var ww = new workingwindow(); ww.showdialog(); var loop = new loopdata(); loop.dosomeloops(); ww.close(); }); })); } } public class loopdata { public void dosomeloops() { (int = 0; < 10000; i++) { system.diagnostics.debug.writeline(i); } } } <controls:metrowindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:custom="http://metro.mahapps.com/winfx/xaml/controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" x:class="metrospinnerpractice.workingwindow" xmlns:controls="clr-namespace:mahapps.metro.controls;assembly=mahapps.metro" title="workingwindow" height="200" width="300"> <grid> <grid.rowdefinitions> <rowdefinition height="*"/> <rowdefinition height="*"/> </grid.rowdefinitions> <stackpanel horizontalalignment="center" height="75" margin="5" grid.row="0" verticalalignment="center" width="275" orientation="horizontal"> <label content="working...." verticalalignment="center" margin="60,20,0,20" fontsize="21.333" horizontalalignment="right" width="120" height="40"/> </stackpanel> <button x:name="btncancelwork" grid.row="1" content="cancel" width="100" height="20" horizontalalignment="center" verticalalignment="center" margin="0" tooltip="cancel current routine"/> </grid>
Comments
Post a Comment