Skip to content

Commit

Permalink
Update to Inventor 2019 and VS 2017
Browse files Browse the repository at this point in the history
  • Loading branch information
adamenagy committed Sep 21, 2019
1 parent db21576 commit 2e61bf9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 81 deletions.
12 changes: 8 additions & 4 deletions GetUserIdProject/GetUserIdProject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\debug\</OutputPath>
<OutputPath>C:\ProgramData\Autodesk\Inventor 2019\Addins\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
Expand Down Expand Up @@ -78,6 +78,9 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="AddinNETFramework.AdWebServicesWrapper">
<HintPath>C:\Program Files\Autodesk\Inventor 2020\Bin\AddinNETFramework.AdWebServicesWrapper.dll</HintPath>
</Reference>
<Reference Include="Autodesk.Inventor.Interop, Version=20.0.0.0, Culture=neutral, PublicKeyToken=d84147f8b4276564, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>False</EmbedInteropTypes>
Expand All @@ -95,13 +98,14 @@
<Compile Include="StandardAddInServer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="WebServicesUtils.cs" />
</ItemGroup>
<ItemGroup>
<None Include="GetUserIdProject.X.manifest" />
</ItemGroup>
<ItemGroup>
<None Include="Autodesk.GetUserIdProject.Inventor.addin" />
<None Include="Autodesk.GetUserIdProject.Inventor.addin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Readme.txt" />
Expand All @@ -110,7 +114,7 @@
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>call "%25VS110COMNTOOLS%25vsvars32"
<PostBuildEvent>call "%25VS150COMNTOOLS%25VsDevCmd"
mt.exe -manifest "$(ProjectDir)GetUserIdProject.X.manifest" -outputresource:"$(TargetPath)";#2</PostBuildEvent>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion GetUserIdProject/GetUserIdProject.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Program</StartAction>
<StartProgram>C:\Program Files\Autodesk\Inventor 2016\Bin\Inventor.exe</StartProgram>
<StartProgram>C:\Program Files\Autodesk\Inventor 2019\Bin\Inventor.exe</StartProgram>
</PropertyGroup>
</Project>
32 changes: 21 additions & 11 deletions GetUserIdProject/StandardAddInServer.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.Runtime.InteropServices;
using Autodesk.WebServices;
using Inventor;
using Microsoft.Win32;
using MsgBox = System.Windows.Forms.MessageBox;
using MsgBox = System.Windows.Forms.MessageBox;

namespace GetUserIdProject
{
Expand Down Expand Up @@ -35,18 +36,27 @@ public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTi
// TODO: Add ApplicationAddInServer.Activate implementation.
// e.g. event initialization, command creation etc.

try
{
string userName;
string userId = WebServicesUtils.GetUserId(out userName);
MsgBox.Show(
"User ID = '" + userId + "\n" +
"User Name = '" + userName + "'");
}
catch (Exception ex)
CWebServicesManager mgr = new CWebServicesManager();
bool isInitialized = mgr.Initialize();

if (isInitialized)
{
MsgBox.Show(ex.Message);
try
{
string userId = "";
mgr.GetUserId(ref userId);
string userName = "";
mgr.GetLoginUserName(ref userName);
MsgBox.Show(
"User ID = '" + userId + "\n" +
"User Name = '" + userName + "'");
}
catch (Exception ex)
{
MsgBox.Show(ex.Message);
}
}

}

public void Deactivate()
Expand Down
65 changes: 0 additions & 65 deletions GetUserIdProject/WebServicesUtils.cs

This file was deleted.

0 comments on commit 2e61bf9

Please sign in to comment.