diff --git a/src/LogcatOutputVsix/LogcatOutput.cs b/src/LogcatOutputVsix/LogcatOutput.cs
index 79d3972..51c524a 100644
--- a/src/LogcatOutputVsix/LogcatOutput.cs
+++ b/src/LogcatOutputVsix/LogcatOutput.cs
@@ -8,9 +8,6 @@
namespace LogcatOutput
{
- ///
- /// Command handler
- ///
internal sealed class LogcatOutput
{
public const int CommandId = 0x0100;
@@ -71,7 +68,7 @@ private async void Execute(object sender, EventArgs e)
this.pane.Clear();
this.pane.OutputString("State: ADB Active\n");
this.state = State.Active;
-
+ this.ReleaseAdbProcess();
this.adb = new Adb();
this.adb.LogReceived += this.Adb_LogReceived;
@@ -79,28 +76,34 @@ private async void Execute(object sender, EventArgs e)
case State.Active:
this.adb.FilterName = "DevLogger";
-
this.pane.Clear();
this.pane.OutputString("State: ADB Active with Filter: 'DevLogger'\n");
-
this.state = State.ActiveWithFilter;
break;
case State.ActiveWithFilter:
- this.adb.LogReceived -= this.Adb_LogReceived;
- this.adb.Dispose();
- this.adb = null;
-
+ this.ReleaseAdbProcess();
this.pane.Clear();
this.pane.OutputString("State: ADB Disabled \n");
-
this.state = State.Disabled;
break;
}
}
+ public void ReleaseAdbProcess()
+ {
+ if (this.adb == null)
+ {
+ return;
+ }
+
+ this.adb.LogReceived -= this.Adb_LogReceived;
+ this.adb.Dispose();
+ this.adb = null;
+ }
+
private async void Adb_LogReceived(object sender, string e)
{
if (this.outputWindow == null)
diff --git a/src/LogcatOutputVsix/LogcatOutputPackage.cs b/src/LogcatOutputVsix/LogcatOutputPackage.cs
index 39fb9d8..6b6e1d8 100644
--- a/src/LogcatOutputVsix/LogcatOutputPackage.cs
+++ b/src/LogcatOutputVsix/LogcatOutputPackage.cs
@@ -28,13 +28,8 @@ namespace LogcatOutput
[ProvideMenuResource("Menus.ctmenu", 1)]
public sealed class LogcatOutputPackage : AsyncPackage
{
- ///
- /// LogcatOutputPackage GUID string.
- ///
public const string PackageGuidString = "03e93c02-9cf9-4aed-a603-aba4d9210d5a";
- #region Package Members
-
///
/// Initialization of the package; this method is called right after the package is sited, so this is the place
/// where you can put all the initialization code that rely on services provided by VisualStudio.
@@ -44,11 +39,14 @@ public sealed class LogcatOutputPackage : AsyncPackage
/// A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress)
{
- // When initialized asynchronously, the current thread may be a background thread at this point.
- // Do any initialization that requires the UI thread after switching to the UI thread.
await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
await LogcatOutput.InitializeAsync(this);
}
- #endregion
+
+ protected override int QueryClose(out bool canClose)
+ {
+ LogcatOutput.Instance.ReleaseAdbProcess();
+ return base.QueryClose(out canClose);
+ }
}
}
diff --git a/src/LogcatOutputVsix/source.extension.vsixmanifest b/src/LogcatOutputVsix/source.extension.vsixmanifest
index 0e8ca0f..32fd2a0 100644
--- a/src/LogcatOutputVsix/source.extension.vsixmanifest
+++ b/src/LogcatOutputVsix/source.extension.vsixmanifest
@@ -1,20 +1,21 @@
-
-
- LogcatOutput
- Empty VSIX Project.
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ LogcatOutput
+ Helps with debugging Xamarin. Usage: Toggle Tools: -> LogcatOutput
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+