init
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interface;
|
||||
using Prism.Ioc;
|
||||
using Prism.Events;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DTS.Viewer.PSDReport
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PSDReportMainViewGrid.xaml
|
||||
/// </summary>
|
||||
public partial class PSDReportMainViewGrid : IPSDReportMainViewGrid
|
||||
{
|
||||
public PSDReportMainViewGrid()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += PSDReportMainViewGrid_Loaded;
|
||||
}
|
||||
|
||||
private IEventAggregator _eventAggregator { get; set; }
|
||||
private void SetFocus()
|
||||
{
|
||||
chartResultsTab.IsSelected = true;
|
||||
chartResultsTab.Focusable = true;
|
||||
chartResultsTab.Focus();
|
||||
}
|
||||
//FB 14797 Subscribe to event after the page loaded to make sure eventAggregator is available
|
||||
private void PSDReportMainViewGrid_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
_eventAggregator = ContainerLocator.Container.Resolve<IEventAggregator>();
|
||||
_eventAggregator?.GetEvent<GraphLoadedCountNotification>().Subscribe(OnGraphLoadedCountNotification);
|
||||
}
|
||||
|
||||
//FB 14797 Set the focus to first tab (chartOptTab) after the graph is fully loaded (3 sec)
|
||||
private void OnGraphLoadedCountNotification(GraphLoadedCountNotificationArg arg)
|
||||
{
|
||||
if (null != DataContext && (IBaseViewModel)DataContext != arg.ParentVM) return;
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(TimeSpan.FromSeconds(3));
|
||||
Dispatcher.BeginInvoke((Action)SetFocus);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user