Adding version number to the settings dialog
Added feature where setup dialog controls are disabled when the telescope or focuser is attached Modified the whole solution to use Any CPU, and changed the installer to use the /register /unregister commands ASCOM Profile for Meade Generic removed on uninstall, but not on upgrade
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -36,6 +36,25 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
||||
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
|
||||
Binary file not shown.
@@ -18,41 +18,6 @@
|
||||
Vital="yes"
|
||||
Assembly=".net"
|
||||
AssemblyApplication="filFocuserDriverAssembly" />
|
||||
<!-- Registry entries suitable for a LocalServer served class -->
|
||||
<!-- HKCR\CLSID\{driver-guid} -->
|
||||
<RegistryKey Root="HKCR" Key="CLSID">
|
||||
<RegistryKey Key="$(var.FocuserDriverClassId)">
|
||||
<RegistryValue Value="$(var.FocuserDriverProgId)" Type="string"/>
|
||||
<RegistryValue Name="AppId" Value="$(var.LocalServerAppId)" Type="string"/>
|
||||
<RegistryKey Key="Implemented Categories">
|
||||
<RegistryKey Key="{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}"
|
||||
ForceCreateOnInstall="yes"
|
||||
ForceDeleteOnUninstall="yes"/>
|
||||
</RegistryKey>
|
||||
<RegistryKey Key="ProgId">
|
||||
<RegistryValue Value="$(var.FocuserDriverProgId)" Type="string"/>
|
||||
</RegistryKey>
|
||||
<RegistryKey Key="Programmable"
|
||||
ForceCreateOnInstall="yes"
|
||||
ForceDeleteOnUninstall="yes" />
|
||||
<RegistryKey Key="LocalServer32">
|
||||
<RegistryValue Value="[#filLocalServerAssembly]" Type="string"/>
|
||||
</RegistryKey>
|
||||
</RegistryKey>
|
||||
</RegistryKey>
|
||||
|
||||
<!-- HKCR\{driver-prog-id} -->
|
||||
<RegistryKey Root="HKCR" Key="$(var.FocuserDriverProgId)">
|
||||
<RegistryValue Value="$(var.FocuserDriverDescription)" Type="string"/>
|
||||
<RegistryKey Key="CLSID">
|
||||
<RegistryValue Value="$(var.FocuserDriverClassId)" Type="string" />
|
||||
</RegistryKey>
|
||||
</RegistryKey>
|
||||
|
||||
<!--Register the driver with the ASCOM Profile-->
|
||||
<RegistryKey Root="HKLM" Key="SOFTWARE\ASCOM\Focuser Drivers\$(var.FocuserDriverProgId)">
|
||||
<RegistryValue Value="$(var.FocuserDriverDescription)" Type="string"/>
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
|
||||
@@ -12,21 +12,31 @@
|
||||
Assembly=".net"
|
||||
AssemblyApplication="filLocalServerAssembly" />
|
||||
</Component>
|
||||
<Component Id="cmpLocalServerRegistry" Win64="no">
|
||||
<!-- LocalServer32 COM Registration -->
|
||||
<RegistryKey Root="HKCR" Key="AppID" >
|
||||
<!-- HKCR\AppID\{my-app-id} -->
|
||||
<RegistryKey Key="$(var.LocalServerAppId)">
|
||||
<RegistryValue Value="$(var.InstallName)" Type="string"/>
|
||||
<RegistryValue Name="AppID" Value="$(var.LocalServerAppId)" Type="string"/>
|
||||
<RegistryValue Name="AuthenticationLevel" Value="1" Type="integer"/>
|
||||
</RegistryKey>
|
||||
<!-- HKCR\AppID\{exe-name} -->
|
||||
<RegistryKey Key="$(var.Meade.net.TargetFileName)">
|
||||
<RegistryValue Name="AppID" Value="$(var.LocalServerAppId)" Type="string"/>
|
||||
</RegistryKey>
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
|
||||
<CustomAction Id="RegisterEXE"
|
||||
Directory="INSTALLFOLDER"
|
||||
ExeCommand=""[#filLocalServerAssembly]" /register"
|
||||
Execute="deferred"
|
||||
Return="ignore"
|
||||
Impersonate="no"
|
||||
/>
|
||||
|
||||
<CustomAction Id="UnRegisterEXE"
|
||||
Directory="INSTALLFOLDER"
|
||||
ExeCommand=""[#filLocalServerAssembly]" /unregister"
|
||||
Execute="deferred"
|
||||
Return="ignore"
|
||||
Impersonate="no"
|
||||
/>
|
||||
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action='RegisterEXE' Before="InstallFinalize">
|
||||
<![CDATA[(NOT Installed)]]>
|
||||
</Custom>
|
||||
<Custom Action="UnRegisterEXE" After="InstallInitialize">
|
||||
<![CDATA[(REMOVE ~= "ALL" AND NOT UPGRADINGPRODUCTCODE)]]>
|
||||
</Custom>
|
||||
</InstallExecuteSequence>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
@@ -18,41 +18,6 @@
|
||||
Vital="yes"
|
||||
Assembly=".net"
|
||||
AssemblyApplication="filTelescopeDriverAssembly" />
|
||||
<!-- Registry entries suitable for a LocalServer served class -->
|
||||
<!-- HKCR\CLSID\{driver-guid} -->
|
||||
<RegistryKey Root="HKCR" Key="CLSID">
|
||||
<RegistryKey Key="$(var.TelescopeDriverClassId)">
|
||||
<RegistryValue Value="$(var.TelescopeDriverProgId)" Type="string"/>
|
||||
<RegistryValue Name="AppId" Value="$(var.LocalServerAppId)" Type="string"/>
|
||||
<RegistryKey Key="Implemented Categories">
|
||||
<RegistryKey Key="{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}"
|
||||
ForceCreateOnInstall="yes"
|
||||
ForceDeleteOnUninstall="yes"/>
|
||||
</RegistryKey>
|
||||
<RegistryKey Key="ProgId">
|
||||
<RegistryValue Value="$(var.TelescopeDriverProgId)" Type="string"/>
|
||||
</RegistryKey>
|
||||
<RegistryKey Key="Programmable"
|
||||
ForceCreateOnInstall="yes"
|
||||
ForceDeleteOnUninstall="yes" />
|
||||
<RegistryKey Key="LocalServer32">
|
||||
<RegistryValue Value="[#filLocalServerAssembly]" Type="string"/>
|
||||
</RegistryKey>
|
||||
</RegistryKey>
|
||||
</RegistryKey>
|
||||
|
||||
<!-- HKCR\{driver-prog-id} -->
|
||||
<RegistryKey Root="HKCR" Key="$(var.TelescopeDriverProgId)">
|
||||
<RegistryValue Value="$(var.TelescopeDriverDescription)" Type="string"/>
|
||||
<RegistryKey Key="CLSID">
|
||||
<RegistryValue Value="$(var.TelescopeDriverClassId)" Type="string" />
|
||||
</RegistryKey>
|
||||
</RegistryKey>
|
||||
|
||||
<!--Register the driver with the ASCOM Profile-->
|
||||
<RegistryKey Root="HKLM" Key="SOFTWARE\ASCOM\Telescope Drivers\$(var.TelescopeDriverProgId)">
|
||||
<RegistryValue Value="$(var.TelescopeDriverDescription)" Type="string"/>
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<RegisterForComInterop>true</RegisterForComInterop>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
@@ -65,7 +65,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<OutputPath>..\bin\Debug\</OutputPath>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ASCOM.Meade.net
|
||||
/// </summary>
|
||||
[Guid("d9fd4b3e-c4f1-48ac-a16f-d02eef30d86f")]
|
||||
[ProgId("ASCOM.MeadeGeneric.Telescope")]
|
||||
[ServedClassName("Meade.net Telescope")]
|
||||
[ServedClassName("Meade Generic")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
public class Telescope : ReferenceCountedObjectBase, ITelescopeV3
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ASCOM.Meade.net
|
||||
/// </summary>
|
||||
[Guid("a32ac647-bf0f-42f9-8ab0-d166fa5884ad")]
|
||||
[ProgId("ASCOM.MeadeGeneric.focuser")]
|
||||
[ServedClassName("Meade.net Focuser")]
|
||||
[ServedClassName("Meade Generic")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
public class Focuser : ReferenceCountedObjectBase, IFocuserV3
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<RegisterForComInterop>true</RegisterForComInterop>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
|
||||
+9
-6
@@ -71,21 +71,23 @@ Global
|
||||
{A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x64.Build.0 = Release|Any CPU
|
||||
{A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x86.ActiveCfg = Release|x86
|
||||
{A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x86.Build.0 = Release|x86
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x64.ActiveCfg = Debug|x86
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x64.Build.0 = Debug|x86
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.Build.0 = Debug|x86
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x64.ActiveCfg = Release|x86
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.ActiveCfg = Release|x86
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.Build.0 = Release|x86
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x64.ActiveCfg = Debug|x86
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x64.Build.0 = Debug|x86
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x86.Build.0 = Debug|x86
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x64.ActiveCfg = Release|x86
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x86.ActiveCfg = Release|x86
|
||||
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x86.Build.0 = Release|x86
|
||||
@@ -101,12 +103,13 @@ Global
|
||||
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x64.Build.0 = Release|Any CPU
|
||||
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x86.ActiveCfg = Release|x86
|
||||
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x86.Build.0 = Release|x86
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.Build.0 = Debug|x86
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x86.Build.0 = Debug|x86
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|Any CPU.Build.0 = Release|x86
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x64.ActiveCfg = Release|x86
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x86.ActiveCfg = Release|x86
|
||||
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x86.Build.0 = Release|x86
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Resources;
|
||||
|
||||
namespace ASCOM.Meade.net
|
||||
{
|
||||
public class AssemblyInfo
|
||||
{
|
||||
// The assembly information values.
|
||||
public string Title = "", Description = "", Company = "",
|
||||
Product = "", Copyright = "", Trademark = "",
|
||||
AssemblyVersion = "", FileVersion = "", Guid = "",
|
||||
NeutralLanguage = "";
|
||||
public bool IsComVisible = false;
|
||||
|
||||
// Return a particular assembly attribute value.
|
||||
public static T GetAssemblyAttribute<T>(Assembly assembly)
|
||||
where T : Attribute
|
||||
{
|
||||
// Get attributes of this type.
|
||||
object[] attributes =
|
||||
assembly.GetCustomAttributes(typeof(T), true);
|
||||
|
||||
// If we didn't get anything, return null.
|
||||
if ((attributes == null) || (attributes.Length == 0))
|
||||
return null;
|
||||
|
||||
// Convert the first attribute value into
|
||||
// the desired type and return it.
|
||||
return (T)attributes[0];
|
||||
}
|
||||
|
||||
// Constructors.
|
||||
public AssemblyInfo()
|
||||
: this(Assembly.GetExecutingAssembly())
|
||||
{
|
||||
}
|
||||
|
||||
public AssemblyInfo(Assembly assembly)
|
||||
{
|
||||
// Get values from the assembly.
|
||||
AssemblyTitleAttribute titleAttr =
|
||||
GetAssemblyAttribute<AssemblyTitleAttribute>(assembly);
|
||||
if (titleAttr != null) Title = titleAttr.Title;
|
||||
|
||||
AssemblyDescriptionAttribute assemblyAttr =
|
||||
GetAssemblyAttribute<AssemblyDescriptionAttribute>(assembly);
|
||||
if (assemblyAttr != null) Description =
|
||||
assemblyAttr.Description;
|
||||
|
||||
AssemblyCompanyAttribute companyAttr =
|
||||
GetAssemblyAttribute<AssemblyCompanyAttribute>(assembly);
|
||||
if (companyAttr != null) Company = companyAttr.Company;
|
||||
|
||||
AssemblyProductAttribute productAttr =
|
||||
GetAssemblyAttribute<AssemblyProductAttribute>(assembly);
|
||||
if (productAttr != null) Product = productAttr.Product;
|
||||
|
||||
AssemblyCopyrightAttribute copyrightAttr =
|
||||
GetAssemblyAttribute<AssemblyCopyrightAttribute>(assembly);
|
||||
if (copyrightAttr != null) Copyright = copyrightAttr.Copyright;
|
||||
|
||||
AssemblyTrademarkAttribute trademarkAttr =
|
||||
GetAssemblyAttribute<AssemblyTrademarkAttribute>(assembly);
|
||||
if (trademarkAttr != null) Trademark = trademarkAttr.Trademark;
|
||||
|
||||
var version = assembly.GetName().Version;
|
||||
AssemblyVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
|
||||
|
||||
|
||||
AssemblyFileVersionAttribute fileVersionAttr =
|
||||
GetAssemblyAttribute<AssemblyFileVersionAttribute>(assembly);
|
||||
if (fileVersionAttr != null) FileVersion =
|
||||
fileVersionAttr.Version;
|
||||
|
||||
GuidAttribute guidAttr = GetAssemblyAttribute<GuidAttribute>(assembly);
|
||||
if (guidAttr != null) Guid = guidAttr.Value;
|
||||
|
||||
NeutralResourcesLanguageAttribute languageAttr =
|
||||
GetAssemblyAttribute<NeutralResourcesLanguageAttribute>(assembly);
|
||||
if (languageAttr != null) NeutralLanguage =
|
||||
languageAttr.CultureName;
|
||||
|
||||
ComVisibleAttribute comAttr =
|
||||
GetAssemblyAttribute<ComVisibleAttribute>(assembly);
|
||||
if (comAttr != null) IsComVisible = comAttr.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-10
@@ -29,6 +29,8 @@ namespace ASCOM.Meade.net
|
||||
public static class Server
|
||||
{
|
||||
|
||||
private const string DRIVER_NAME = "Meade Generic";
|
||||
|
||||
#region Access to kernel32.dll, user32.dll, and ole32.dll functions
|
||||
[Flags]
|
||||
enum Clsctx : uint
|
||||
@@ -256,8 +258,8 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Failed to load served COM class assembly " + fi.Name + " - " + e.Message,
|
||||
"Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
MessageBox.Show($"Failed to load served COM class assembly {fi.Name} - {e.Message}",
|
||||
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -293,12 +295,11 @@ namespace ASCOM.Meade.net
|
||||
try { Process.Start(si); }
|
||||
catch (System.ComponentModel.Win32Exception)
|
||||
{
|
||||
MessageBox.Show("The Meade.net was not " + (arg == "/register" ? "registered" : "unregistered") +
|
||||
" because you did not allow it.", "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show($"The {DRIVER_NAME} was not {(arg == "/register" ? "registered" : "unregistered")} because you did not allow it.", DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.ToString(), "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
MessageBox.Show(ex.ToString(), DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -356,8 +357,8 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error while registering the server:\n" + ex.ToString(),
|
||||
"Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
MessageBox.Show($"Error while registering the server:\n{ex}",
|
||||
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
return;
|
||||
}
|
||||
finally
|
||||
@@ -426,7 +427,7 @@ namespace ASCOM.Meade.net
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error while registering the server:\n" + ex.ToString(),
|
||||
"Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
bFail = true;
|
||||
}
|
||||
finally
|
||||
@@ -514,7 +515,7 @@ namespace ASCOM.Meade.net
|
||||
if (!factory.RegisterClassObject())
|
||||
{
|
||||
MessageBox.Show("Failed to register class factory for " + type.Name,
|
||||
"Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -570,7 +571,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
default:
|
||||
MessageBox.Show("Unknown argument: " + args[0] + "\nValid are : -register, -unregister and -embedding",
|
||||
"Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -68,7 +69,7 @@
|
||||
<OutputPath>..\bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
@@ -121,6 +122,7 @@
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="ClassFactory.cs" />
|
||||
<Compile Include="ConnectionInfo.cs" />
|
||||
<Compile Include="frmMain.cs">
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyDescription("ASCOM multi-interface server for Meade.net")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("cjdawson.com")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyProduct("ASCOM Meade Generic")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019 cjdawson.com")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ASCOM.Meade.net
|
||||
@@ -13,6 +11,10 @@ namespace ASCOM.Meade.net
|
||||
public SetupDialogForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var assemblyInfo = new AssemblyInfo();
|
||||
|
||||
Text = $"{assemblyInfo.Product} Settings ({assemblyInfo.AssemblyVersion})";
|
||||
}
|
||||
|
||||
private void cmdCancel_Click(object sender, EventArgs e) // Cancel button event handler
|
||||
@@ -113,5 +115,20 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
UpdateOKButton();
|
||||
}
|
||||
|
||||
public void SetReadOnlyMode()
|
||||
{
|
||||
foreach (Control control in Controls)
|
||||
{
|
||||
control.Enabled = false;
|
||||
}
|
||||
|
||||
cmdCancel.Enabled = true;
|
||||
//cmdOK.Enabled = false;
|
||||
//comboBoxComPort.Enabled = false;
|
||||
//chkTrace.Enabled = false;
|
||||
//txtGuideRate.Enabled = false;
|
||||
//cboPrecision.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@
|
||||
<value>12, 9</value>
|
||||
</data>
|
||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>123, 31</value>
|
||||
<value>274, 31</value>
|
||||
</data>
|
||||
<data name="label1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ASCOM.Utilities;
|
||||
|
||||
namespace ASCOM.Meade.net
|
||||
@@ -226,7 +227,12 @@ namespace ASCOM.Meade.net
|
||||
using (SetupDialogForm f = new SetupDialogForm())
|
||||
{
|
||||
f.SetProfile(profileProperties);
|
||||
|
||||
|
||||
if (IsConnected())
|
||||
{
|
||||
f.SetReadOnlyMode();
|
||||
}
|
||||
|
||||
var result = f.ShowDialog();
|
||||
if (result == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
@@ -332,6 +338,17 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsConnected()
|
||||
{
|
||||
foreach (var device in _connectedDevices)
|
||||
{
|
||||
if (device.Value.Count > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsConnected(string deviceId)
|
||||
{
|
||||
if (_connectedDevices.ContainsKey(deviceId))
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
@@ -36,6 +36,25 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
||||
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
||||
|
||||
Reference in New Issue
Block a user