dispose players

This commit is contained in:
Vitalii Ganzha 2015-06-08 12:05:20 -07:00
parent 2fe9ae0ccb
commit 5fc511bd9b
3 changed files with 21 additions and 2 deletions

1
.gitignore vendored
View File

@ -154,3 +154,4 @@ $RECYCLE.BIN/
# Mac desktop service store files # Mac desktop service store files
.DS_Store .DS_Store
/VsDingExtensionProject/pingme.txt

View File

@ -21,7 +21,7 @@
[Guid(GuidList.guidVsDingExtensionProjectPkgString)] [Guid(GuidList.guidVsDingExtensionProjectPkgString)]
[ProvideAutoLoad("{f1536ef8-92ec-443c-9ed7-fdadf150da82}")] [ProvideAutoLoad("{f1536ef8-92ec-443c-9ed7-fdadf150da82}")]
[ProvideOptionPage(typeof(OptionsDialog), "Ding", "Options", 0, 0, true)] [ProvideOptionPage(typeof(OptionsDialog), "Ding", "Options", 0, 0, true)]
public sealed class VsDingExtensionProjectPackage : Package public sealed class VsDingExtensionProjectPackage : Package, IDisposable
{ {
private DTE2 applicationObject; private DTE2 applicationObject;
private AddIn addInInstance; private AddIn addInInstance;
@ -141,5 +141,23 @@
return activeProcId == procId; return activeProcId == procId;
} }
public void Dispose()
{
SafeDispose(this.debugSoundPlayer);
SafeDispose(this.buildCompleteSoundPlayer);
SafeDispose(this.testCompleteSoundPlayer);
}
private void SafeDispose(SoundPlayer soundPlayer)
{
try
{
soundPlayer.Dispose();
}
catch (Exception ex)
{
ActivityLog.LogError(this.GetType().FullName, "Error when disposing player: " + ex.Message);
}
}
} }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011"> <PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata> <Metadata>
<Identity Id="26ba08d0-0d25-4479-8684-3054dd122876" Version="1.3" Language="en-US" Publisher="Vitalii Ganzha" /> <Identity Id="26ba08d0-0d25-4479-8684-3054dd122876" Version="1.4" Language="en-US" Publisher="Vitalii Ganzha" />
<DisplayName>Visual Studio Ding extension</DisplayName> <DisplayName>Visual Studio Ding extension</DisplayName>
<Description xml:space="preserve">This small extension will play notification sounds when following events occur: <Description xml:space="preserve">This small extension will play notification sounds when following events occur:
- Build Complete - Build Complete