Example #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);
            }
        }
Example #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);
            }
        }
Example #3
0
        private async void ScrollToHighlightedLyricsLineAsync()
        {
            if (this.lyricsListBox == null)
            {
                return;
            }

            try
            {
                // When shutting down, Application.Current is null
                if (Application.Current != null)
                {
                    await Application.Current.Dispatcher.Invoke(async() =>
                    {
                        await ScrollUtils.ScrollToHighlightedLyricsLineAsync(this.lyricsListBox);
                    });
                }
            }
            catch (Exception ex)
            {
                LogClient.Error("Could not scroll to the highlighted lyrics line. Exception: {0}", ex.Message);
            }
        }
Example #4
0
 private void ForwardButton_OnClick(object sender, RoutedEventArgs e)
 {
     ScrollUtils.ScrollItem(ItemsListView, 1);
 }