private async void TimeToAddSnow(ThreadPoolTimer timer) { await this.canvas.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { Snow snow = new Snow(rand.Next(0, this._pageWidth), 0, this.sizeOfSnow[rand.Next(0, 3)]); listSnow.Add(snow); this.canvas.Children.Add(snow.tb); _snowCount++; if (this._snowCount >= TotalSnowCount) { this.timerToCreateSnow.Cancel(); this.timerToCreateSnow = null; } }); }
private async void TimeToAddSnow(ThreadPoolTimer timer) { await this.canvas.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { Snow snow = new Snow(rand.Next(0, this._pageWidth), 0, this.sizeOfSnow[rand.Next(0,3)]); listSnow.Add(snow); this.canvas.Children.Add(snow.tb); _snowCount++; if (this._snowCount >= TotalSnowCount) { this.timerToCreateSnow.Cancel(); this.timerToCreateSnow = null; } }); }