@@ -105,6 +105,7 @@ private void MainFormLoaded(Object sender, EventArgs e)
105
105
private ToolStripProgressBar toolStripProgressBar ;
106
106
private ToolStripStatusLabel toolStripProgressLabel ;
107
107
private ToolStripStatusLabel toolStripStatusLabel ;
108
+ private ToolStripButton restartButton ;
108
109
private ProcessRunner processRunner ;
109
110
110
111
/* Dialogs */
@@ -741,13 +742,26 @@ private void AppManUpdate(Object sender, FileSystemEventArgs e)
741
742
String contents = File . ReadAllText ( appMan ) ;
742
743
if ( contents == "restart" )
743
744
{
744
- String message = TextHelper . GetString ( "Info.RequiresRestart" ) ;
745
- TraceManager . Add ( message ) ;
745
+ this . RestartRequired ( ) ;
746
746
}
747
747
}
748
748
catch { } // No errors...
749
749
}
750
750
751
+ /// <summary>
752
+ /// Initializes the restart button
753
+ /// </summary>
754
+ private void InitializeRestartButton ( )
755
+ {
756
+ this . restartButton = new ToolStripButton ( ) ;
757
+ this . restartButton . Image = this . FindImage ( "69" ) ;
758
+ this . restartButton . Alignment = ToolStripItemAlignment . Right ;
759
+ this . restartButton . ToolTipText = TextHelper . GetString ( "Info.RequiresRestart" ) ;
760
+ this . restartButton . Click += delegate { this . Restart ( null , null ) ; } ;
761
+ this . restartButton . Visible = false ;
762
+ this . toolStrip . Items . Add ( this . restartButton ) ;
763
+ }
764
+
751
765
/// <summary>
752
766
/// Initializes the smart dialogs
753
767
/// </summary>
@@ -1164,6 +1178,10 @@ private void OnMainFormLoad(Object sender, System.EventArgs e)
1164
1178
*/
1165
1179
this . InitializeWindow ( ) ;
1166
1180
/**
1181
+ * Initializes the restart button
1182
+ */
1183
+ this . InitializeRestartButton ( ) ;
1184
+ /**
1167
1185
* Check for updates when needed
1168
1186
*/
1169
1187
this . CheckForUpdates ( ) ;
@@ -1964,6 +1982,16 @@ public void ShowErrorDialog(Object sender, Exception ex)
1964
1982
else ErrorDialog . Show ( ex ) ;
1965
1983
}
1966
1984
1985
+ /// <summary>
1986
+ /// Show a message to the user to restart FD
1987
+ /// </summary>
1988
+ public void RestartRequired ( )
1989
+ {
1990
+ if ( this . restartButton != null ) this . restartButton . Visible = true ;
1991
+ String message = TextHelper . GetString ( "Info.RequiresRestart" ) ;
1992
+ TraceManager . Add ( message ) ;
1993
+ }
1994
+
1967
1995
/// <summary>
1968
1996
/// Refreshes the main form
1969
1997
/// </summary>
@@ -3028,7 +3056,7 @@ public void ExtractZip(Object sender, System.EventArgs e)
3028
3056
{
3029
3057
zipLog += "Restart required.\r \n " ;
3030
3058
if ( ! silentInstall ) finish += "\n " + restart ;
3031
- else TraceManager . AddAsync ( restart ) ;
3059
+ this . RestartRequired ( ) ;
3032
3060
}
3033
3061
String logFile = Path . Combine ( PathHelper . BaseDir , "Extensions.log" ) ;
3034
3062
File . AppendAllText ( logFile , zipLog + "Done.\r \n \r \n " , Encoding . UTF8 ) ;
@@ -3113,7 +3141,7 @@ public void RemoveZip(Object sender, System.EventArgs e)
3113
3141
{
3114
3142
zipLog += "Restart required.\r \n " ;
3115
3143
if ( ! silentRemove ) finish += "\n " + restart ;
3116
- else TraceManager . AddAsync ( restart ) ;
3144
+ this . RestartRequired ( ) ;
3117
3145
}
3118
3146
String logFile = Path . Combine ( PathHelper . BaseDir , "Extensions.log" ) ;
3119
3147
File . AppendAllText ( logFile , zipLog + "Done.\r \n \r \n " , Encoding . UTF8 ) ;
0 commit comments