@@ -644,16 +644,18 @@ private bool downloadRoute(string installPathRoute)
644
644
645
645
while ( downloadThread . IsAlive )
646
646
{
647
- Stopwatch sw = Stopwatch . StartNew ( ) ;
648
-
649
647
TotalBytes = 0 ;
648
+
650
649
sumMB ( installPathRoute ) ;
651
650
AutoInstallSynchronizationContext . Post ( new SendOrPostCallback ( o =>
652
651
{
652
+ ( ( MainForm ) Owner ) . Cursor = Cursors . WaitCursor ;
653
+
653
654
dataGridViewAutoInstall . CurrentRow . Cells [ 1 ] . Value =
654
655
string . Format ( "Downloaded: {0} kB" , ( string ) o ) ;
655
656
} ) , ( TotalBytes / 1024 ) . ToString ( "N0" ) ) ;
656
657
658
+ Stopwatch sw = Stopwatch . StartNew ( ) ;
657
659
while ( ( downloadThread . IsAlive ) & & ( sw . ElapsedMilliseconds <= 1000 ) ) { }
658
660
}
659
661
@@ -671,16 +673,17 @@ private bool downloadRoute(string installPathRoute)
671
673
672
674
while ( installThread . IsAlive )
673
675
{
674
- Stopwatch sw = Stopwatch . StartNew ( ) ;
675
-
676
676
TotalBytes = - bytesZipfile ;
677
677
sumMB ( installPathRoute ) ;
678
678
AutoInstallSynchronizationContext . Post ( new SendOrPostCallback ( o =>
679
679
{
680
+ ( ( MainForm ) Owner ) . Cursor = Cursors . WaitCursor ;
681
+
680
682
dataGridViewAutoInstall . CurrentRow . Cells [ 1 ] . Value =
681
683
string . Format ( "Installed: {0} kB" , ( string ) o ) ;
682
684
} ) , ( TotalBytes / 1024 ) . ToString ( "N0" ) ) ;
683
685
686
+ Stopwatch sw = Stopwatch . StartNew ( ) ;
684
687
while ( ( installThread . IsAlive ) & & ( sw . ElapsedMilliseconds <= 1000 ) ) { }
685
688
}
686
689
}
@@ -838,6 +841,15 @@ private bool insertRowInOptions(string installPathRoute)
838
841
AutoInstallRoutes [ AutoInstallRouteName ] . ContentName = routeName ;
839
842
AutoInstallRoutes [ AutoInstallRouteName ] . ContentDirectory = installPathRouteReal ;
840
843
844
+ // insert into Manually Installed data grid
845
+ int indexAdded = dataGridViewManualInstall . Rows . Add ( new string [ ] {
846
+ routeName ,
847
+ installPathRouteReal
848
+ } ) ;
849
+ dataGridViewManualInstall . Rows [ indexAdded ] . Cells [ 1 ] . ToolTipText = installPathRouteReal ;
850
+ dataGridViewManualInstall . Rows [ indexAdded ] . DefaultCellStyle . ForeColor = Color . Gray ;
851
+ dataGridViewManualInstall . Sort ( dataGridViewManualInstall . Columns [ 0 ] , ListSortDirection . Ascending ) ;
852
+
841
853
return true ;
842
854
}
843
855
@@ -954,6 +966,11 @@ private async void buttonAutoInstallDelete_Click(object sender, EventArgs e)
954
966
if ( Settings . Folders . Folders [ route . ContentName ] == route . ContentDirectory )
955
967
{
956
968
Settings . Folders . Folders . Remove ( route . ContentName ) ;
969
+ int index = findIndexDgvManualInstall ( route . ContentName ) ;
970
+ if ( index > - 1 )
971
+ {
972
+ dataGridViewManualInstall . Rows . RemoveAt ( index ) ;
973
+ }
957
974
}
958
975
Settings . Folders . Save ( ) ;
959
976
}
@@ -991,19 +1008,21 @@ private void deleteRoute(string directoryInstalledIn)
991
1008
// this will stop the delete until the sum is done
992
1009
AutoInstallDoingTheSumOfTheFileBytes = true ;
993
1010
994
- Stopwatch sw = Stopwatch . StartNew ( ) ;
995
1011
TotalBytes = 0 ;
996
1012
if ( sumMB ( directoryInstalledIn ) )
997
1013
{
998
1014
AutoInstallSynchronizationContext . Post ( new SendOrPostCallback ( o =>
999
1015
{
1016
+ ( ( MainForm ) Owner ) . Cursor = Cursors . WaitCursor ;
1017
+
1000
1018
dataGridViewAutoInstall . CurrentRow . Cells [ 1 ] . Value =
1001
1019
string . Format ( "Left: {0} kB" , ( string ) o ) ;
1002
1020
} ) , ( TotalBytes / 1024 ) . ToString ( "N0" ) ) ;
1003
1021
}
1004
1022
1005
1023
AutoInstallDoingTheSumOfTheFileBytes = false ;
1006
1024
1025
+ Stopwatch sw = Stopwatch . StartNew ( ) ;
1007
1026
while ( deleteThread . IsAlive && ( sw . ElapsedMilliseconds <= 1000 ) ) { }
1008
1027
}
1009
1028
}
@@ -1032,8 +1051,7 @@ private void setCursorToWaitCursor()
1032
1051
{
1033
1052
AutoInstallClosingBlocked = true ;
1034
1053
1035
- MainForm mainForm = ( MainForm ) Owner ;
1036
- mainForm . Cursor = Cursors . WaitCursor ;
1054
+ ( ( MainForm ) Owner ) . Cursor = Cursors . WaitCursor ;
1037
1055
}
1038
1056
1039
1057
private void EnableAutoInstalButtons ( )
@@ -1055,8 +1073,7 @@ private void EnableAutoInstalButtons()
1055
1073
1056
1074
private void setCursorToDefaultCursor ( )
1057
1075
{
1058
- MainForm mainForm = ( MainForm ) Owner ;
1059
- mainForm . Cursor = Cursors . Default ;
1076
+ ( ( MainForm ) Owner ) . Cursor = Cursors . Default ;
1060
1077
1061
1078
AutoInstallClosingBlocked = false ;
1062
1079
}
@@ -1632,6 +1649,18 @@ private string findPathInDgvManualInstall(string route)
1632
1649
return "" ;
1633
1650
}
1634
1651
1652
+ private int findIndexDgvManualInstall ( string route )
1653
+ {
1654
+ for ( int i = 0 ; i < dataGridViewManualInstall . Rows . Count ; i ++ )
1655
+ {
1656
+ if ( dataGridViewManualInstall . Rows [ i ] . Cells [ 0 ] . Value . ToString ( ) . Equals ( route ) )
1657
+ {
1658
+ return i ;
1659
+ }
1660
+ }
1661
+ return - 1 ;
1662
+ }
1663
+
1635
1664
private void DownloadContentForm_FormClosing ( object sender , FormClosingEventArgs formClosingEventArgs )
1636
1665
{
1637
1666
if ( AutoInstallClosingBlocked )
0 commit comments