diff --git a/Common/Config/Storage/ASCOMProfile.cs b/Common/Config/Storage/ASCOMProfile.cs index e02683a..ec7af40 100644 --- a/Common/Config/Storage/ASCOMProfile.cs +++ b/Common/Config/Storage/ASCOMProfile.cs @@ -20,7 +20,7 @@ namespace Common.Config.Storage { - public class ASCOMProfile : IConfigStorage + public class ASCOMProfile : IConfigStorage, IDisposable { private ASCOM.Utilities.Profile Profile; public string ProfileName { get; set; } @@ -107,5 +107,32 @@ public void WriteStringToProfile(string Key, string Value, string Folder) { Profile.WriteValue(ProfileName, Key, Value, Folder); } + + #region IDisposable Support + private bool disposedValue = false; // To detect redundant calls + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + if (disposing) + { + if (Profile != null) + { + Profile.Dispose(); + Profile = null; + } + } + + disposedValue = true; + } + } + + // This code added to correctly implement the disposable pattern. + public void Dispose() + { + Dispose(true); + } + #endregion } } diff --git a/Driver/Base.cs b/Driver/Base.cs index ee12159..5177f2b 100644 --- a/Driver/Base.cs +++ b/Driver/Base.cs @@ -30,7 +30,7 @@ namespace ASCOM.Ardufocus.Driver /// /// ASCOM Focuser Driver for Ardufocus. /// - [ComVisible(false)] + [ComVisible(true)] public abstract class FocuserBase : ReferenceCountedObjectBase, IFocuserV3 { protected virtual string GET_CURRENT_POS { get { return "GP"; } } diff --git a/HandController/Context.cs b/HandController/Context.cs index 86e8d8f..dd928a4 100644 --- a/HandController/Context.cs +++ b/HandController/Context.cs @@ -36,11 +36,6 @@ public Context() HandController.Show(); } - ~Context() - { - - } - internal static void TriggerUpdateUIState() { HandController.Invalidate(); diff --git a/LocalServer/GarbageCollection.cs b/LocalServer/GarbageCollection.cs index 24c0454..45b0333 100644 --- a/LocalServer/GarbageCollection.cs +++ b/LocalServer/GarbageCollection.cs @@ -24,7 +24,7 @@ namespace ASCOM.Ardufocus /// /// Summary description for GarbageCollection. /// - class GarbageCollection + class GarbageCollection : IDisposable { protected bool m_bContinueThread; protected bool m_GCWatchStopped; @@ -71,5 +71,14 @@ public void WaitForThreadToStop() m_EventThreadEnded.WaitOne(); m_EventThreadEnded.Reset(); } + + public void Dispose() + { + if (m_EventThreadEnded != null) + { + m_EventThreadEnded.Dispose(); + m_EventThreadEnded = null; + } + } } } diff --git a/LocalServer/GlobalSuppressions.cs b/LocalServer/GlobalSuppressions.cs new file mode 100644 index 0000000..25e17a4 Binary files /dev/null and b/LocalServer/GlobalSuppressions.cs differ diff --git a/LocalServer/LocalServer.csproj b/LocalServer/LocalServer.csproj index 6553b21..9a2c785 100644 --- a/LocalServer/LocalServer.csproj +++ b/LocalServer/LocalServer.csproj @@ -92,6 +92,7 @@ DebugForm.cs + diff --git a/LocalServer/ReferenceCountedObject.cs b/LocalServer/ReferenceCountedObject.cs index c23947f..0edecd2 100644 --- a/LocalServer/ReferenceCountedObject.cs +++ b/LocalServer/ReferenceCountedObject.cs @@ -21,7 +21,7 @@ namespace ASCOM.Ardufocus { - [ComVisible(false)] + [ComVisible(true)] public class ReferenceCountedObjectBase { public ReferenceCountedObjectBase() diff --git a/ardufocus-driver.sln b/ardufocus-driver.sln index c7b3376..fb394e4 100644 --- a/ardufocus-driver.sln +++ b/ardufocus-driver.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.136 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28803.156 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{D5207217-61C7-4E94-8097-91DBACE57D2A}" ProjectSection(ProjectDependencies) = postProject @@ -36,33 +36,43 @@ Global {D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.ActiveCfg = Release|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.Build.0 = Release|x86 {D0E9BFCF-5EDD-4ED1-8EE5-33274DCAAA5E}.Debug|Any CPU.ActiveCfg = Debug|x86 + {D0E9BFCF-5EDD-4ED1-8EE5-33274DCAAA5E}.Debug|Any CPU.Build.0 = Debug|x86 {D0E9BFCF-5EDD-4ED1-8EE5-33274DCAAA5E}.Debug|x86.ActiveCfg = Debug|x86 {D0E9BFCF-5EDD-4ED1-8EE5-33274DCAAA5E}.Debug|x86.Build.0 = Debug|x86 {D0E9BFCF-5EDD-4ED1-8EE5-33274DCAAA5E}.Release|Any CPU.ActiveCfg = Release|x86 + {D0E9BFCF-5EDD-4ED1-8EE5-33274DCAAA5E}.Release|Any CPU.Build.0 = Release|x86 {D0E9BFCF-5EDD-4ED1-8EE5-33274DCAAA5E}.Release|x86.ActiveCfg = Release|x86 {D0E9BFCF-5EDD-4ED1-8EE5-33274DCAAA5E}.Release|x86.Build.0 = Release|x86 {2F0ADE0F-17B5-4447-A32C-0E6D542289F0}.Debug|Any CPU.ActiveCfg = Debug|x86 + {2F0ADE0F-17B5-4447-A32C-0E6D542289F0}.Debug|Any CPU.Build.0 = Debug|x86 {2F0ADE0F-17B5-4447-A32C-0E6D542289F0}.Debug|x86.ActiveCfg = Debug|x86 {2F0ADE0F-17B5-4447-A32C-0E6D542289F0}.Debug|x86.Build.0 = Debug|x86 {2F0ADE0F-17B5-4447-A32C-0E6D542289F0}.Release|Any CPU.ActiveCfg = Release|x86 + {2F0ADE0F-17B5-4447-A32C-0E6D542289F0}.Release|Any CPU.Build.0 = Release|x86 {2F0ADE0F-17B5-4447-A32C-0E6D542289F0}.Release|x86.ActiveCfg = Release|x86 {2F0ADE0F-17B5-4447-A32C-0E6D542289F0}.Release|x86.Build.0 = Release|x86 {3689A2CB-94C5-4012-A5CF-7E7D1DD27143}.Debug|Any CPU.ActiveCfg = Debug|x86 + {3689A2CB-94C5-4012-A5CF-7E7D1DD27143}.Debug|Any CPU.Build.0 = Debug|x86 {3689A2CB-94C5-4012-A5CF-7E7D1DD27143}.Debug|x86.ActiveCfg = Debug|x86 {3689A2CB-94C5-4012-A5CF-7E7D1DD27143}.Debug|x86.Build.0 = Debug|x86 {3689A2CB-94C5-4012-A5CF-7E7D1DD27143}.Release|Any CPU.ActiveCfg = Release|x86 + {3689A2CB-94C5-4012-A5CF-7E7D1DD27143}.Release|Any CPU.Build.0 = Release|x86 {3689A2CB-94C5-4012-A5CF-7E7D1DD27143}.Release|x86.ActiveCfg = Release|x86 {3689A2CB-94C5-4012-A5CF-7E7D1DD27143}.Release|x86.Build.0 = Release|x86 {8E8D406C-1838-4914-867D-AB602D0EAF3E}.Debug|Any CPU.ActiveCfg = Debug|x86 + {8E8D406C-1838-4914-867D-AB602D0EAF3E}.Debug|Any CPU.Build.0 = Debug|x86 {8E8D406C-1838-4914-867D-AB602D0EAF3E}.Debug|x86.ActiveCfg = Debug|x86 {8E8D406C-1838-4914-867D-AB602D0EAF3E}.Debug|x86.Build.0 = Debug|x86 {8E8D406C-1838-4914-867D-AB602D0EAF3E}.Release|Any CPU.ActiveCfg = Release|x86 + {8E8D406C-1838-4914-867D-AB602D0EAF3E}.Release|Any CPU.Build.0 = Release|x86 {8E8D406C-1838-4914-867D-AB602D0EAF3E}.Release|x86.ActiveCfg = Release|x86 {8E8D406C-1838-4914-867D-AB602D0EAF3E}.Release|x86.Build.0 = Release|x86 {64308775-BD4A-469C-BCAB-3ED830B811AF}.Debug|Any CPU.ActiveCfg = Debug|x86 + {64308775-BD4A-469C-BCAB-3ED830B811AF}.Debug|Any CPU.Build.0 = Debug|x86 {64308775-BD4A-469C-BCAB-3ED830B811AF}.Debug|x86.ActiveCfg = Debug|x86 {64308775-BD4A-469C-BCAB-3ED830B811AF}.Debug|x86.Build.0 = Debug|x86 {64308775-BD4A-469C-BCAB-3ED830B811AF}.Release|Any CPU.ActiveCfg = Release|x86 + {64308775-BD4A-469C-BCAB-3ED830B811AF}.Release|Any CPU.Build.0 = Release|x86 {64308775-BD4A-469C-BCAB-3ED830B811AF}.Release|x86.ActiveCfg = Release|x86 {64308775-BD4A-469C-BCAB-3ED830B811AF}.Release|x86.Build.0 = Release|x86 EndGlobalSection