Skip to content

Commit 5cba601

Browse files
committed
Added a button to indicate that restart is needed to the right corner of the toolbar. Its also exposed to plugins. Closes #712.
1 parent cde0e1a commit 5cba601

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

FlashDevelop/MainForm.cs

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ private void MainFormLoaded(Object sender, EventArgs e)
105105
private ToolStripProgressBar toolStripProgressBar;
106106
private ToolStripStatusLabel toolStripProgressLabel;
107107
private ToolStripStatusLabel toolStripStatusLabel;
108+
private ToolStripButton restartButton;
108109
private ProcessRunner processRunner;
109110

110111
/* Dialogs */
@@ -741,13 +742,26 @@ private void AppManUpdate(Object sender, FileSystemEventArgs e)
741742
String contents = File.ReadAllText(appMan);
742743
if (contents == "restart")
743744
{
744-
String message = TextHelper.GetString("Info.RequiresRestart");
745-
TraceManager.Add(message);
745+
this.RestartRequired();
746746
}
747747
}
748748
catch {} // No errors...
749749
}
750750

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+
751765
/// <summary>
752766
/// Initializes the smart dialogs
753767
/// </summary>
@@ -1164,6 +1178,10 @@ private void OnMainFormLoad(Object sender, System.EventArgs e)
11641178
*/
11651179
this.InitializeWindow();
11661180
/**
1181+
* Initializes the restart button
1182+
*/
1183+
this.InitializeRestartButton();
1184+
/**
11671185
* Check for updates when needed
11681186
*/
11691187
this.CheckForUpdates();
@@ -1964,6 +1982,16 @@ public void ShowErrorDialog(Object sender, Exception ex)
19641982
else ErrorDialog.Show(ex);
19651983
}
19661984

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+
19671995
/// <summary>
19681996
/// Refreshes the main form
19691997
/// </summary>
@@ -3028,7 +3056,7 @@ public void ExtractZip(Object sender, System.EventArgs e)
30283056
{
30293057
zipLog += "Restart required.\r\n";
30303058
if (!silentInstall) finish += "\n" + restart;
3031-
else TraceManager.AddAsync(restart);
3059+
this.RestartRequired();
30323060
}
30333061
String logFile = Path.Combine(PathHelper.BaseDir, "Extensions.log");
30343062
File.AppendAllText(logFile, zipLog + "Done.\r\n\r\n", Encoding.UTF8);
@@ -3113,7 +3141,7 @@ public void RemoveZip(Object sender, System.EventArgs e)
31133141
{
31143142
zipLog += "Restart required.\r\n";
31153143
if (!silentRemove) finish += "\n" + restart;
3116-
else TraceManager.AddAsync(restart);
3144+
this.RestartRequired();
31173145
}
31183146
String logFile = Path.Combine(PathHelper.BaseDir, "Extensions.log");
31193147
File.AppendAllText(logFile, zipLog + "Done.\r\n\r\n", Encoding.UTF8);

PluginCore/PluginCore/Interfaces.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ public interface IMainForm : IContainerControl, IWin32Window
112112
/// </summary>
113113
void RefreshSciConfig();
114114
/// <summary>
115+
/// Shows a message to restart FD.
116+
/// </summary>
117+
void RestartRequired();
118+
/// <summary>
115119
/// Themes the controls from the parent.
116120
/// </summary>
117121
void ThemeControls(Object control);

0 commit comments

Comments
 (0)