在 Windows phone 8.1 中 begin invoke 的替代方法是什么
what is alternative for begin invoke in Windows phone 8.1
static long dd = 0, hh = 0, mm = 0, ss = 0, ms = 0;
static Stopwatch stopwatch = new Stopwatch();
Timer stopwatch_timer;
static Boolean Stp = true;
private void Start_Click(object sender, RoutedEventArgs e) // Stopwatch start
{
Stp = false;
stopwatch_timer = new Timer(new TimerCallback(updatedisplay), TimerDisplay, 0, 100);
stopwatch.Start();
}
private void updatedisplay(object displayblock)
{
ms = stopwatch.ElapsedMilliseconds;
TextBox Bd = (TextBox)displayblock;
ss = ms / 1000; ms = ms % 1000;
mm = ss / 60; ss = ss % 60;
hh = mm / 60; mm = mm % 60;
dd = hh / 24; hh = hh % 24;
Bd.Dispatcher.BeginInvoke(delegate() { Bd.Text = dd.ToString("00") + ":" + hh.ToString("00") + ":" + mm.ToString("00") + ":" + ss.ToString("00") + ":" + ms.ToString("000"); });
} //Cant use begin Invoke Error - Windows.Ui.Core.Coredispatcher doesn't contain definition for Begin Invoke
我想知道Begin Invoke的替代方法以及如何实现它。一些细节和例子会有很大帮助。
Dispatcher.BeginInvoke( () => {});
被
取代
private async Task MyMethod()
{
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { });
}
static long dd = 0, hh = 0, mm = 0, ss = 0, ms = 0;
static Stopwatch stopwatch = new Stopwatch();
Timer stopwatch_timer;
static Boolean Stp = true;
private void Start_Click(object sender, RoutedEventArgs e) // Stopwatch start
{
Stp = false;
stopwatch_timer = new Timer(new TimerCallback(updatedisplay), TimerDisplay, 0, 100);
stopwatch.Start();
}
private void updatedisplay(object displayblock)
{
ms = stopwatch.ElapsedMilliseconds;
TextBox Bd = (TextBox)displayblock;
ss = ms / 1000; ms = ms % 1000;
mm = ss / 60; ss = ss % 60;
hh = mm / 60; mm = mm % 60;
dd = hh / 24; hh = hh % 24;
Bd.Dispatcher.BeginInvoke(delegate() { Bd.Text = dd.ToString("00") + ":" + hh.ToString("00") + ":" + mm.ToString("00") + ":" + ss.ToString("00") + ":" + ms.ToString("000"); });
} //Cant use begin Invoke Error - Windows.Ui.Core.Coredispatcher doesn't contain definition for Begin Invoke
我想知道Begin Invoke的替代方法以及如何实现它。一些细节和例子会有很大帮助。
Dispatcher.BeginInvoke( () => {});
被
取代private async Task MyMethod()
{
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { });
}