コード例 #1
0
        private void configureAutoTask(Boolean enable, int period)
        {
            if (enable)
            {
                if (autoforwardTimer != null)
                {
                    autoforwardTimer.Cancel();
                }

                autoforwardTimer = ThreadPoolTimer.CreatePeriodicTimer((source) =>
                {
                    Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        medialist.incrementPosition();
                    });
                }, TimeSpan.FromSeconds(period));
                Debug.WriteLine(autoforwardTimer.ToString());
            }
            else
            {
                if (autoforwardTimer != null)
                {
                    autoforwardTimer.Cancel();
                }
            }
        }