@@ -15,12 +15,13 @@ public MainWindow()
1515
1616 if ( App . mArgs != null && App . mArgs . Length > 0 )
1717 {
18- //String[] args = App.mArgs;
1918 fieldSource . Text = checkForBackslash ( App . mArgs [ 0 ] ) ;
2019 }
2120 }
22- private void copyToServer ( object sender , RoutedEventArgs e )
21+ private void StartRobocopy ( object sender , RoutedEventArgs e )
2322 {
23+ var button = sender as System . Windows . Controls . Button ;
24+
2425 string command ;
2526 string sourcePath = checkForBackslash ( fieldSource . Text ) ;
2627 string destinationPath = checkForBackslash ( fieldDestination . Text ) ;
@@ -58,15 +59,25 @@ private void copyToServer(object sender, RoutedEventArgs e)
5859
5960 if ( sourcePath . Length != 0 && destinationPath . Length != 0 )
6061 {
61- btn_startCopying . IsEnabled = false ;
62- command = optionClose + "ROBOCOPY \" " + @sourcePath + "\" \" " + @destinationPath + "\" " + optionE + optionXO + optionMOV + standardOptions ;
63- System . Diagnostics . Process process = System . Diagnostics . Process . Start ( "CMD.exe" , command ) ;
64- process . WaitForExit ( ) ;
65- Application . Current . Shutdown ( ) ;
62+ if ( button . Name == "btn_startCopying" )
63+ {
64+ btn_startCopying . IsEnabled = false ;
65+ command = optionClose + "ROBOCOPY \" " + @sourcePath + "\" \" " + @destinationPath + "\" " + optionE + optionXO + optionMOV + standardOptions ;
66+ System . Diagnostics . Process process = System . Diagnostics . Process . Start ( "CMD.exe" , command ) ;
67+ process . WaitForExit ( ) ;
68+ Application . Current . Shutdown ( ) ;
6669
67- if ( option_Shutdown . IsChecked == true )
70+ if ( option_Shutdown . IsChecked == true )
71+ {
72+ _ = System . Diagnostics . Process . Start ( "Shutdown" , "-s -t 10" ) ;
73+ }
74+ }
75+ else if ( button . Name == "btn_startComparing" )
6876 {
69- _ = System . Diagnostics . Process . Start ( "Shutdown" , "-s -t 10" ) ;
77+ btn_startComparing . IsEnabled = false ;
78+ command = optionClose + "ROBOCOPY \" " + @sourcePath + "\" \" " + @destinationPath + "\" " + "/L /NJH /NJS /NP /NS" ;
79+ System . Diagnostics . Process process = System . Diagnostics . Process . Start ( "CMD.exe" , command ) ;
80+ process . WaitForExit ( ) ;
7081 }
7182 }
7283 else
@@ -85,10 +96,10 @@ private void selectDestinationFolder(object sender, RoutedEventArgs e)
8596 {
8697 switch ( button . Name )
8798 {
88- case "buttonSourcePath " :
99+ case "btn_SourcePath " :
89100 fieldSource . Text = dialog . FileName ;
90101 break ;
91- case "buttonDestinationPath " :
102+ case "btn_DestinationPath " :
92103 fieldDestination . Text = dialog . FileName ;
93104 break ;
94105 default :
0 commit comments