Ejemplo n.º 1
0
        private async Task ScrollToPlayingTrackAsync(DataGrid dataGrid)
        {
            // This should provide a smoother experience because after this wait,
            // other animations on the UI should have finished executing.
            await Task.Delay(Convert.ToInt32(Constants.ScrollToPlayingTrackTimeoutSeconds * 1000));

            try
            {
                await Application.Current.Dispatcher.Invoke(async() =>
                {
                    await ScrollUtils.ScrollToPlayingTrackAsync(dataGrid);
                });
            }
            catch (Exception ex)
            {
                LogClient.Instance.Logger.Error("Could not scroll to the playing track. Exception: {1}", ex.Message);
            }
        }
Ejemplo n.º 2
0
        protected override async Task ScrollToPlayingTrackAsync(Object sender)
        {
            try
            {
                // Cast sender to ListBox
                ListBox lb = (ListBox)sender;

                // This should provide a smoother experience because after this wait,
                // other animations on the UI should have finished executing.
                await Task.Delay(Convert.ToInt32(Constants.ScrollToPlayingTrackTimeoutSeconds * 1000));

                await Application.Current.Dispatcher.Invoke(async() =>
                {
                    await ScrollUtils.ScrollToPlayingTrackAsync(lb, typeof(TrackViewModel));
                });
            }
            catch (Exception ex)
            {
                LogClient.Error("Could not scroll to the playing track. Exception: {0}", ex.Message);
            }
        }