OpenSource » SampleCode » NexportWebApiMvcSampleSite Sample MVC 4 Website project that demonstrates the use of the NexPort WebApi
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

Added client, changed web page appearance.

Changeset 492258920646

Parent a6bf72278fa7

by Profile picture of User 240Clayton Miller <clayton.miller@nexportengineering.com>

Changes to 91 files · Browse files at 492258920646 Showing diff from parent a6bf72278fa7 Diff from another changeset...

Change 1 of 1 Show Entire File NexportWebApiDemo.Models/​App.config Stacked
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
 
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> + </startup> +</configuration> \ No newline at end of file
Change 1 of 1 Show Entire File NexportWebApiDemo.Models/​NexportWebApiDemo.Models.csproj Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{7F7AD021-87AB-493A-A4E5-E2E73A844852}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>NexportWebApiDemo.Models</RootNamespace> + <AssemblyName>NexportWebApiDemo.Models</AssemblyName> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup> + <StartupObject /> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="v1\WebApiModels.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file
Change 1 of 1 Show Entire File NexportWebApiDemo.Models/​Properties/​AssemblyInfo.cs Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
@@ -0,0 +1,36 @@
+using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("NexportWebApiDemo.Models")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NexportWebApiDemo.Models")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("40c13dc2-f730-4576-8f9a-bf8937b83133")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
 
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> + </startup> +</configuration> \ No newline at end of file
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
@@ -0,0 +1,6 @@
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\obj\Debug\NexportWebApiDemo.Models.csprojResolveAssemblyReference.cache +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\bin\Debug\NexportWebApiDemo.Models.dll.config +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\bin\Debug\NexportWebApiDemo.Models.dll +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\bin\Debug\NexportWebApiDemo.Models.pdb +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\obj\Debug\NexportWebApiDemo.Models.dll +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemo.Models\obj\Debug\NexportWebApiDemo.Models.pdb
 
 
 
 
 
 
(No changes)
(No changes)
(No changes)
Change 1 of 1 Show Entire File NexportWebApiDemo.Models/​v1/​WebApiModels.cs Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
@@ -0,0 +1,28 @@
+using System; + +namespace NexportWebApiDemo.Models.v1 +{ + public class WAAuthTokenRequest + { + public string username { get; set; } + public string password { get; set; } + public string grant_type { get; set; } + public string scope { get; set; } + } + + public class WAAuthenticationTokenResponse + { + public Guid access_token { get; set; } + public string token_type { get; set; } + public int expires_in { get; set; } + } + + public class GetUserResponse + { + public Guid user_id { get; set; } + public string first_name { get; set; } + public string middle_name { get; set; } + public string last_name { get; set; } + public string email { get; set; } + } +}
 
71
72
73
74
75
 
 
 
76
77
78
 
71
72
73
 
 
74
75
76
77
78
79
@@ -71,8 +71,9 @@
  <Reference Include="Microsoft.Owin.Security.OAuth">   <HintPath>packages\Microsoft.Owin.Security.OAuth.2.0.0\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>   </Reference> - <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> - <HintPath>packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath> + <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>   </Reference>   <Reference Include="Owin">   <HintPath>packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
 
4
5
6
 
 
 
 
 
 
 
 
 
 
 
7
8
9
 
15
16
17
 
 
 
 
 
 
 
 
18
19
20
 
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
26
27
28
29
30
31
32
33
34
35
36
37
38
39
@@ -4,6 +4,17 @@
 VisualStudioVersion = 12.0.31101.0  MinimumVisualStudioVersion = 10.0.40219.1  Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexportWebApiDemo", "NexportWebApiDemo.csproj", "{7F88E760-CFA0-4D95-ACD2-3CB76C9E4AE2}" + ProjectSection(ProjectDependencies) = postProject + {7F7AD021-87AB-493A-A4E5-E2E73A844852} = {7F7AD021-87AB-493A-A4E5-E2E73A844852} + {204EFCCB-1C1C-45E4-ACE8-CA6166A03C53} = {204EFCCB-1C1C-45E4-ACE8-CA6166A03C53} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexportWebApiDemoClient", "..\NexportWebApiDemoClient\NexportWebApiDemoClient.csproj", "{204EFCCB-1C1C-45E4-ACE8-CA6166A03C53}" + ProjectSection(ProjectDependencies) = postProject + {7F7AD021-87AB-493A-A4E5-E2E73A844852} = {7F7AD021-87AB-493A-A4E5-E2E73A844852} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NexportWebApiDemo.Models", "..\NexportWebApiDemo.Models\NexportWebApiDemo.Models.csproj", "{7F7AD021-87AB-493A-A4E5-E2E73A844852}"  EndProject  Global   GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +26,14 @@
  {7F88E760-CFA0-4D95-ACD2-3CB76C9E4AE2}.Debug|Any CPU.Build.0 = Debug|Any CPU   {7F88E760-CFA0-4D95-ACD2-3CB76C9E4AE2}.Release|Any CPU.ActiveCfg = Release|Any CPU   {7F88E760-CFA0-4D95-ACD2-3CB76C9E4AE2}.Release|Any CPU.Build.0 = Release|Any CPU + {204EFCCB-1C1C-45E4-ACE8-CA6166A03C53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {204EFCCB-1C1C-45E4-ACE8-CA6166A03C53}.Debug|Any CPU.Build.0 = Debug|Any CPU + {204EFCCB-1C1C-45E4-ACE8-CA6166A03C53}.Release|Any CPU.ActiveCfg = Release|Any CPU + {204EFCCB-1C1C-45E4-ACE8-CA6166A03C53}.Release|Any CPU.Build.0 = Release|Any CPU + {7F7AD021-87AB-493A-A4E5-E2E73A844852}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F7AD021-87AB-493A-A4E5-E2E73A844852}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F7AD021-87AB-493A-A4E5-E2E73A844852}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F7AD021-87AB-493A-A4E5-E2E73A844852}.Release|Any CPU.Build.0 = Release|Any CPU   EndGlobalSection   GlobalSection(SolutionProperties) = preSolution   HideSolutionNode = FALSE
 
 
 
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
 
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
207
208
209
210
211
212
213
214
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
217
218
 
249
250
251
252
253
 
 
254
255
256
 
70
71
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
74
75
 
158
159
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
 
 
 
 
 
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
 
241
242
243
 
 
244
245
246
247
248
@@ -70,37 +70,6 @@
    <div class="col-md-9">   - <div class="row carousel-holder"> - - <div class="col-md-12"> - <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> - <ol class="carousel-indicators"> - <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li> - <li data-target="#carousel-example-generic" data-slide-to="1"></li> - <li data-target="#carousel-example-generic" data-slide-to="2"></li> - </ol> - <div class="carousel-inner"> - <div class="item active"> - <img class="slide-image" src="http://placehold.it/800x300" alt=""> - </div> - <div class="item"> - <img class="slide-image" src="http://placehold.it/800x300" alt=""> - </div> - <div class="item"> - <img class="slide-image" src="http://placehold.it/800x300" alt=""> - </div> - </div> - <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"> - <span class="glyphicon glyphicon-chevron-left"></span> - </a> - <a class="right carousel-control" href="#carousel-example-generic" data-slide="next"> - <span class="glyphicon glyphicon-chevron-right"></span> - </a> - </div> - </div> - - </div> -   <div class="row">     <div class="col-sm-4 col-lg-4 col-md-4"> @@ -189,30 +158,53 @@
  </p>   </div>   </div> - </div> - - <div class="col-sm-4 col-lg-4 col-md-4"> - <div class="thumbnail"> - <img src="http://placehold.it/320x150" alt=""> - <div class="caption"> - <h4 class="pull-right">$94.99</h4> - <h4><a href="#">Fifth Product</a> - </h4> - <p>This is a short description. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> - </div> - <div class="ratings"> - <p class="pull-right">18 reviews</p> - <p> + </div> + + <div class="col-sm-4 col-lg-4 col-md-4"> + <div class="thumbnail"> + <img src="http://placehold.it/320x150" alt=""> + <div class="caption"> + <h4 class="pull-right">$94.99</h4> + <h4><a href="#">Fifth Product</a> + </h4> + <p>This is a short description. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> + </div> + <div class="ratings"> + <p class="pull-right">18 reviews</p> + <p>   <span class="glyphicon glyphicon-star"></span>   <span class="glyphicon glyphicon-star"></span>   <span class="glyphicon glyphicon-star"></span>   <span class="glyphicon glyphicon-star"></span>   <span class="glyphicon glyphicon-star-empty"></span> - </p> - </div> - </div> - </div> - + </p> + </div> + </div> + </div> + + + <div class="col-sm-4 col-lg-4 col-md-4"> + <div class="thumbnail"> + <img src="http://placehold.it/320x150" alt=""> + <div class="caption"> + <h4 class="pull-right">$94.99</h4> + <h4> + <a href="#">Fifth Product</a> + </h4> + <p>This is a short description. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> + </div> + <div class="ratings"> + <p class="pull-right">18 reviews</p> + <p> + <span class="glyphicon glyphicon-star"></span> + <span class="glyphicon glyphicon-star"></span> + <span class="glyphicon glyphicon-star"></span> + <span class="glyphicon glyphicon-star"></span> + <span class="glyphicon glyphicon-star-empty"></span> + </p> + </div> + </div> + </div>   <div class="col-sm-4 col-lg-4 col-md-4">   <h4><a href="#">Like this template?</a>   </h4> @@ -249,8 +241,8 @@
  <script src="js/jquery.js"></script>     <!-- Bootstrap Core JavaScript --> - <script src="js/bootstrap.min.js"></script> - + <script src="js/bootstrap.min.js"></script> +  </body>    </html>
 
17
18
19
20
21
22
23
24
25
26
27
28
29
 
30
31
 
 
17
18
19
 
 
 
 
 
20
21
22
23
 
24
25
26
 
@@ -17,15 +17,10 @@
  <body>   <div class="container">   <div class="header"> - <ul class="nav nav-pills pull-right"> - <li class="active"><a href="#">Home</a></li> - <li><a href="#">About</a></li> - <li><a href="#">Contact</a></li> - </ul>   <h3 class="text-muted">@ViewBag.Title</h3>   </div>   @RenderBody()   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> - <script src="@Url.Content("~/js/bootstrap.js")"></script> + <script src="@Url.Content("~/js/bootstrap.min.js")"></script>   </body>  </html> \ No newline at end of file
 
56
57
58
59
 
60
61
62
 
56
57
58
 
59
60
61
62
@@ -56,7 +56,7 @@
  </dependentAssembly>   <dependentAssembly>   <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />   </dependentAssembly>   </assemblyBinding>   </runtime>
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
 
56
57
58
59
 
60
61
62
 
56
57
58
 
59
60
61
62
@@ -56,7 +56,7 @@
  </dependentAssembly>   <dependentAssembly>   <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" /> + <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />   </dependentAssembly>   </assemblyBinding>   </runtime>
 
 
 
 
 
 
 
 
 
 
 
26
27
28
29
 
30
31
32
 
26
27
28
 
29
30
31
32
@@ -26,7 +26,7 @@
  <package id="Microsoft.Owin.Security.Twitter" version="2.0.0" targetFramework="net45" />   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />   <package id="Modernizr" version="2.6.2" targetFramework="net45" /> - <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" /> + <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />   <package id="Owin" version="1.0" targetFramework="net45" />   <package id="Respond" version="1.2.0" targetFramework="net45" />   <package id="WebGrease" version="1.5.2" targetFramework="net45" />
 
 
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
@@ -0,0 +1,93 @@
+param($installPath, $toolsPath, $package, $project) + +# open json.net splash page on package install +# don't open if json.net is installed as a dependency + +try +{ + $url = "http://james.newtonking.com/json" + $dte2 = Get-Interface $dte ([EnvDTE80.DTE2]) + + if ($dte2.ActiveWindow.Caption -eq "Package Manager Console") + { + # user is installing from VS NuGet console + # get reference to the window, the console host and the input history + # show webpage if "install-package newtonsoft.json" was last input + + $consoleWindow = $(Get-VSComponentModel).GetService([NuGetConsole.IPowerConsoleWindow]) + + $props = $consoleWindow.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor ` + [System.Reflection.BindingFlags]::NonPublic) + + $prop = $props | ? { $_.Name -eq "ActiveHostInfo" } | select -first 1 + if ($prop -eq $null) { return } + + $hostInfo = $prop.GetValue($consoleWindow) + if ($hostInfo -eq $null) { return } + + $history = $hostInfo.WpfConsole.InputHistory.History + + $lastCommand = $history | select -last 1 + + if ($lastCommand) + { + $lastCommand = $lastCommand.Trim().ToLower() + if ($lastCommand.StartsWith("install-package") -and $lastCommand.Contains("newtonsoft.json")) + { + $dte2.ItemOperations.Navigate($url) | Out-Null + } + } + } + else + { + # user is installing from VS NuGet dialog + # get reference to the window, then smart output console provider + # show webpage if messages in buffered console contains "installing...newtonsoft.json" in last operation + + $instanceField = [NuGet.Dialog.PackageManagerWindow].GetField("CurrentInstance", [System.Reflection.BindingFlags]::Static -bor ` + [System.Reflection.BindingFlags]::NonPublic) + $consoleField = [NuGet.Dialog.PackageManagerWindow].GetField("_smartOutputConsoleProvider", [System.Reflection.BindingFlags]::Instance -bor ` + [System.Reflection.BindingFlags]::NonPublic) + if ($instanceField -eq $null -or $consoleField -eq $null) { return } + + $instance = $instanceField.GetValue($null) + if ($instance -eq $null) { return } + + $consoleProvider = $consoleField.GetValue($instance) + if ($consoleProvider -eq $null) { return } + + $console = $consoleProvider.CreateOutputConsole($false) + + $messagesField = $console.GetType().GetField("_messages", [System.Reflection.BindingFlags]::Instance -bor ` + [System.Reflection.BindingFlags]::NonPublic) + if ($messagesField -eq $null) { return } + + $messages = $messagesField.GetValue($console) + if ($messages -eq $null) { return } + + $operations = $messages -split "==============================" + + $lastOperation = $operations | select -last 1 + + if ($lastOperation) + { + $lastOperation = $lastOperation.ToLower() + + $lines = $lastOperation -split "`r`n" + + $installMatch = $lines | ? { $_.StartsWith("------- installing...newtonsoft.json ") } | select -first 1 + + if ($installMatch) + { + $dte2.ItemOperations.Navigate($url) | Out-Null + } + } + } +} +catch +{ + # stop potential errors from bubbling up + # worst case the splash page won't open +} + +# yolo \ No newline at end of file
 
1
2
 
 
 
3
4
 
 
1
2
3
4
5
6
7
 
@@ -1,4 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>  <repositories> + <repository path="..\..\..\NexPort\NexPort.Models\packages.config" /> + <repository path="..\..\..\NexPort\NexPortVirtualCampus\packages.config" /> + <repository path="..\..\NexportWebApiDemoClient\packages.config" />   <repository path="..\packages.config" />  </repositories> \ No newline at end of file
Change 1 of 1 Show Entire File NexportWebApiDemoClient/​App.config Stacked
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
 
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> + </startup> +</configuration> \ No newline at end of file
Change 1 of 1 Show Entire File NexportWebApiDemoClient/​NexportWebApiDemoClient.csproj Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{204EFCCB-1C1C-45E4-ACE8-CA6166A03C53}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>NexportWebApiDemoClient</RootNamespace> + <AssemblyName>NexportWebApiDemoClient</AssemblyName> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\NexportWebApiDemo\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\NexportWebApiDemo\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath> + </Reference> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="WebApiClient.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="WebApiRequests.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\NexportWebApiDemo.Models\NexportWebApiDemo.Models.csproj"> + <Project>{7F7AD021-87AB-493A-A4E5-E2E73A844852}</Project> + <Name>NexportWebApiDemo.Models</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file
Change 1 of 1 Show Entire File NexportWebApiDemoClient/​Properties/​AssemblyInfo.cs Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
@@ -0,0 +1,36 @@
+using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("NexportWebApiDemoClient")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NexportWebApiDemoClient")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d28dcc1e-ac24-40bc-adf2-3e282086c86f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]
Change 1 of 1 Show Entire File NexportWebApiDemoClient/​WebApiClient.cs Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@@ -0,0 +1,42 @@
+using System; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading.Tasks; +using NexportWebApiDemo.Models.v1; + +namespace NexportWebApiDemoClient +{ + class WebApiClient + { + static void Main() + { + RunAsync().Wait(); + } + + static async Task RunAsync() + { + using (var client = new HttpClient()) + { + client.BaseAddress = new Uri("http://local.nexportcampus.com/api/v1/"); + client.DefaultRequestHeaders.Accept.Clear(); + client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + + //Get authentication token (POST method) + var authRequest = new WAAuthTokenRequest() + { + username = "Clay0M", + password = "password", + grant_type = "password" + }; + var authResponse = WebApiRequests.Authenticate(authRequest); + + var accessToken = authResponse.access_token; + + var getUserResponse = WebApiRequests.GetUser("Clay0M", accessToken); + + Console.WriteLine("{0}\t{1}\t{2}\t{3}\t", getUserResponse.first_name, getUserResponse.middle_name, + getUserResponse.last_name, getUserResponse.email); + } + } + } +}
Change 1 of 1 Show Entire File NexportWebApiDemoClient/​WebApiRequests.cs Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
@@ -0,0 +1,39 @@
+using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; +using NexportWebApiDemo.Models.v1; + +namespace NexportWebApiDemoClient +{ + class WebApiRequests + { + private static string BaseUri = "http://local.nexportcampus.com/api/v1/"; + + public static WAAuthenticationTokenResponse Authenticate(WAAuthTokenRequest request) + { + using (var client = new HttpClient()) + { + var requestUri = BaseUri + "AdminApi/Authenticate"; + var response = client.PostAsJsonAsync(requestUri, request).Result; + + //TODO Check return status + return response.Content.ReadAsAsync<WAAuthenticationTokenResponse>().Result; + } + } + + public static GetUserResponse GetUser(string login, Guid accessToken) + { + using (var client = new HttpClient()) + { + var requestUri = BaseUri + "AdminApi/GetUser?login=" + login + "&access_token=" + accessToken; + var response = client.GetAsync(requestUri).Result; + + return response.Content.ReadAsAsync<GetUserResponse>().Result; + } + } + } +}
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
 
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> + </startup> +</configuration> \ No newline at end of file
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
 
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> + </startup> +</configuration> \ No newline at end of file
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> + <security> + <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> + <requestedExecutionLevel level="asInvoker" uiAccess="false"/> + </requestedPrivileges> + </security> + </trustInfo> +</assembly>
 
 
This file's diff was not loaded because this changeset is very large. Load changes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
@@ -0,0 +1,12 @@
+C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\NexportWebApiDemoClient.exe.config +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\NexportWebApiDemoClient.exe +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\NexportWebApiDemoClient.pdb +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\Newtonsoft.Json.dll +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\System.Net.Http.Formatting.dll +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\Newtonsoft.Json.xml +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\System.Net.Http.Formatting.xml +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\obj\Debug\NexportWebApiDemoClient.csprojResolveAssemblyReference.cache +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\obj\Debug\NexportWebApiDemoClient.exe +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\obj\Debug\NexportWebApiDemoClient.pdb +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\NexportWebApiDemo.Models.dll +C:\Sandbox\NexportWebApiDemo\NexportWebApiDemoClient\bin\Debug\NexportWebApiDemo.Models.pdb
 
 
 
 
 
 
(No changes)
(No changes)
(No changes)
Change 1 of 1 Show Entire File NexportWebApiDemoClient/​packages.config Stacked
 
 
 
 
 
 
 
 
1
2
3
4
5
 
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" /> + <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" /> +</packages> \ No newline at end of file