@@ -812,9 +812,10 @@ private void AddOfflineDataSource(FactoryContainer fc, IAnalogyDataProvidersFact
812
812
813
813
#region actions
814
814
815
- void OpenOffline ( string titleOfDataSource , string initialFolder , string [ ] files = null )
815
+ async Task OpenOffline ( string titleOfDataSource , string initialFolder , string [ ] files = null )
816
816
{
817
817
openedWindows ++ ;
818
+ await FactoriesManager . Instance . InitializeIfNeeded ( offlineAnalogy ) ;
818
819
UserControl offlineUC = new LocalLogFilesUC ( offlineAnalogy , files , initialFolder ) ;
819
820
var page = dockManager1 . AddPanel ( DockingStyle . Float ) ;
820
821
page . DockedAsTabbedDocument = true ;
@@ -887,7 +888,10 @@ void OnXtcLogsOnControlRemoved(object sender, DockPanelEventArgs arg)
887
888
specificLocalFolder . Style = ElementStyle . Item ;
888
889
specificLocalFolder . Text = "Open Pre-defined Folder" ;
889
890
specificLocalFolder . ImageOptions . Image = images ? . GetLargeOpenFolderImage ( factoryId ) ?? Resources . OpenFolder_32x32 ;
890
- specificLocalFolder . Click += ( sender , e ) => { OpenOffline ( title , specificDirectory ) ; } ;
891
+ specificLocalFolder . Click += async ( sender , e ) =>
892
+ {
893
+ await OpenOffline ( title , specificDirectory ) ;
894
+ } ;
891
895
}
892
896
893
897
AccordionControlElement recentFolders = new AccordionControlElement { Text = "Recent Folders" } ;
@@ -898,7 +902,7 @@ void OnXtcLogsOnControlRemoved(object sender, DockPanelEventArgs arg)
898
902
localfolder . Style = ElementStyle . Item ;
899
903
localfolder . Text = "Open Folder Selection" ;
900
904
localfolder . ImageOptions . Image = images ? . GetLargeOpenFolderImage ( factoryId ) ?? Resources . OpenFolder_32x32 ;
901
- localfolder . Click += ( sender , e ) =>
905
+ localfolder . Click += async ( sender , e ) =>
902
906
{
903
907
using ( var folderBrowserDialog = new XtraFolderBrowserDialog { ShowNewFolderButton = false } )
904
908
{
@@ -910,7 +914,7 @@ void OnXtcLogsOnControlRemoved(object sender, DockPanelEventArgs arg)
910
914
{
911
915
if ( ! string . IsNullOrEmpty ( folderBrowserDialog . SelectedPath ) )
912
916
{
913
- OpenOffline ( title , folderBrowserDialog . SelectedPath ) ;
917
+ await OpenOffline ( title , folderBrowserDialog . SelectedPath ) ;
914
918
AddRecentFolder ( recentFolders , offlineAnalogy , title , folderBrowserDialog . SelectedPath ) ;
915
919
}
916
920
}
@@ -935,9 +939,9 @@ void OnXtcLogsOnControlRemoved(object sender, DockPanelEventArgs arg)
935
939
// args.Contents.Image = realTime.ToolTip.Image;
936
940
toolTip . Setup ( args ) ;
937
941
btn . SuperTip = toolTip ;
938
- btn . Click += ( s , be ) =>
942
+ btn . Click += async ( s , be ) =>
939
943
{
940
- OpenOffline ( offlineAnalogy . OptionalTitle , path . Path ) ;
944
+ await OpenOffline ( offlineAnalogy . OptionalTitle , path . Path ) ;
941
945
} ;
942
946
}
943
947
}
@@ -955,7 +959,7 @@ void OnXtcLogsOnControlRemoved(object sender, DockPanelEventArgs arg)
955
959
acRootGroupHome . Elements . Add ( openFiles ) ;
956
960
openFiles . Style = ElementStyle . Item ;
957
961
openFiles . ImageOptions . Image = offlineAnalogy . LargeImage ?? Resources . Article_32x32 ;
958
- openFiles . Click += ( sender , e ) =>
962
+ openFiles . Click += async ( sender , e ) =>
959
963
{
960
964
OpenFileDialog openFileDialog1 = new OpenFileDialog
961
965
{
@@ -965,7 +969,7 @@ void OnXtcLogsOnControlRemoved(object sender, DockPanelEventArgs arg)
965
969
} ;
966
970
if ( openFileDialog1 . ShowDialog ( ) == DialogResult . OK )
967
971
{
968
- OpenOffline ( title , offlineAnalogy . InitialFolderFullPath , openFileDialog1 . FileNames ) ;
972
+ await OpenOffline ( title , offlineAnalogy . InitialFolderFullPath , openFileDialog1 . FileNames ) ;
969
973
AddRecentFiles ( recentfiles , offlineAnalogy , title , openFileDialog1 . FileNames . ToList ( ) ) ;
970
974
}
971
975
} ;
@@ -1308,8 +1312,9 @@ private void AddSingleDataSources(FactoryContainer fc, IAnalogyDataProvidersFact
1308
1312
singleBtn . SuperTip = toolTip ;
1309
1313
}
1310
1314
openedWindows ++ ;
1311
- singleBtn . Click += ( sender , e ) =>
1315
+ singleBtn . Click += async ( sender , e ) =>
1312
1316
{
1317
+ await FactoriesManager . Instance . InitializeIfNeeded ( single ) ;
1313
1318
CancellationTokenSource cts = new CancellationTokenSource ( ) ;
1314
1319
LocalLogFilesUC offlineUC = new LocalLogFilesUC ( single , cts ) ;
1315
1320
var page = dockManager1 . AddPanel ( DockingStyle . Float ) ;
0 commit comments