aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/<
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Tango.PPC.Events.Views
{
    /// <summary>
    /// Interaction logic for MainView.xaml
    /// </summary>
    public partial class MainView : UserControl
    {
        public MainView()
        {
            InitializeComponent();
        }

        private void dataGridEvent_SelectionChanged(object sender, EventArgs e)
        {
            Task.Delay(100).ContinueWith((x) =>
            {
                this.BeginInvoke(() =>
                {
                    dataGridEvent.LayoutRows(false);

                    var selected_row = dataGridEvent.GetRows().FirstOrDefault(y => y.IsSelected);

                    if (selected_row != null)
                    {
                        dataGridEvent.ScrollViewer.ScrollToElement(selected_row);
                    }
                });
            });
        }

        private void gridEventsHistory_SelectionChanged(object sender, EventArgs e)
        {
            Task.Delay(100).ContinueWith((x) =>
            {
                this.BeginInvoke(() =>
                {
                    gridEventsHistory.LayoutRows(false);

                    var selected_row = gridEventsHistory.GetRows().FirstOrDefault(y => y.IsSelected);

                    if (selected_row != null)
                    {
                        gridEventsHistory.ScrollViewer.ScrollToElement(selected_row);
                    }
                });
            });
        }
    }
}