Fixed button not disabling when there is no available FlightEngineerCore.
Fixed button not disabling when there is no available FlightEngineerCore.

--- a/KerbalEngineer/EngineerGlobals.cs
+++ b/KerbalEngineer/EngineerGlobals.cs
@@ -33,7 +33,7 @@
         /// <summary>
         ///     Current version of the Kerbal Engineer assembly.
         /// </summary>
-        public const string AssemblyVersion = "1.0.4";
+        public const string AssemblyVersion = "1.0.5";
 
         #endregion
 

--- a/KerbalEngineer/Flight/ActionMenu.cs
+++ b/KerbalEngineer/Flight/ActionMenu.cs
@@ -49,6 +49,29 @@
             {
                 GameEvents.onGUIApplicationLauncherReady.Add(this.OnGuiAppLauncherReady);
                 Logger.Log("ActionMenu was created.");
+            }
+            catch (Exception ex)
+            {
+                Logger.Exception(ex);
+            }
+        }
+
+        #endregion
+
+        #region Updating
+
+        private void Update()
+        {
+            try
+            {
+                if (FlightEngineerCore.Instance != null && this.button.State == RUIToggleButton.ButtonState.DISABLED)
+                {
+                    this.button.Enable();
+                }
+                else if (FlightEngineerCore.Instance == null && this.button.State != RUIToggleButton.ButtonState.DISABLED)
+                {
+                    this.button.Disable();
+                }
             }
             catch (Exception ex)
             {
@@ -76,6 +99,8 @@
                 this.actionMenuGui = this.button.gameObject.AddComponent<ActionMenuGui>();
                 this.actionMenuGui.transform.parent = this.button.transform;
                 ApplicationLauncher.Instance.EnableMutuallyExclusive(this.button);
+                GameEvents.onHideUI.Add(this.OnHide);
+                GameEvents.onShowUI.Add(this.OnShow);
             }
             catch (Exception ex)
             {
@@ -134,6 +159,30 @@
             }
         }
 
+        private void OnHide()
+        {
+            try
+            {
+                this.actionMenuGui.Hidden = true;
+            }
+            catch (Exception ex)
+            {
+                Logger.Exception(ex);
+            }
+        }
+
+        private void OnShow()
+        {
+            try
+            {
+                this.actionMenuGui.Hidden = false;
+            }
+            catch (Exception ex)
+            {
+                Logger.Exception(ex);
+            }
+        }
+
         #endregion
 
         #region Destruction
@@ -143,6 +192,8 @@
             try
             {
                 GameEvents.onGUIApplicationLauncherReady.Remove(this.OnGuiAppLauncherReady);
+                GameEvents.onHideUI.Remove(this.OnHide);
+                GameEvents.onShowUI.Remove(this.OnShow);
                 ApplicationLauncher.Instance.RemoveModApplication(this.button);
                 Logger.Log("ActionMenu was destroyed.");
             }

--- a/KerbalEngineer/Flight/ActionMenuGui.cs
+++ b/KerbalEngineer/Flight/ActionMenuGui.cs
@@ -43,6 +43,8 @@
 
         public bool StayOpen { get; set; }
         public bool Hovering { get; set; }
+
+        public bool Hidden { get; set; }
 
         #endregion
 
@@ -129,6 +131,11 @@
         {
             try
             {
+                if (this.Hidden)
+                {
+                    return;
+                }
+
                 if (!this.position.Contains(Event.current.mousePosition) && !this.StayOpen && !this.Hovering)
                 {
                     this.enabled = false;

 Binary files a/Output/KerbalEngineer/KerbalEngineer.dll and b/Output/KerbalEngineer/KerbalEngineer.dll differ
--- a/Output/KerbalEngineer/KerbalEngineer.version
+++ b/Output/KerbalEngineer/KerbalEngineer.version
@@ -6,7 +6,7 @@
 	{
 		"MAJOR":1,
 		"MINOR":0,
-		"PATCH":4,
+		"PATCH":5,
 		"BUILD":0
 	},
 	"KSP_VERSION":

--- a/Output/ReadMe.htm
+++ b/Output/ReadMe.htm
@@ -162,6 +162,8 @@
 						<li>Changed: Misc category now called Miscellaneous (this will cause previously added readouts from this category to vanish).</li>
 						<li>Fixed: Bug with the Build Engineer toolbar button.</li>
 						<li>Fixed: Some buggyness when trying to close the bodies drop-down in the Build Engineer via the button.</li>
+						<li>Fixed: Flight Engineer toolbar menu now hides when hiding the GUI with F2.</li>
+						<li>Fixed: Flight Engineer toolbar button now disables when in module mode and no engineer is running.</li>
 					</ul>
 				</li>
 				<li>1.0.4.0