Added Console code sample
This commit is contained in:
Родитель
80e2047691
Коммит
1365f09c71
|
@ -274,4 +274,6 @@ __pycache__/
|
|||
# Cake - Uncomment if you are using it
|
||||
# tools/
|
||||
|
||||
|
||||
# Ignore updates to the App.config file in the sample app. This file will contain sensitive data (credentials). By uploading an empty version of it earlier and now ignoring it, this will prevent credentials from being published to GitHub.
|
||||
Samples/WPF/RESTToolkitTestApp/App.config
|
||||
|
|
|
@ -22,6 +22,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RESTToolkitTestApp", "Sampl
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BingMapsRESTToolkit", "Source\BingMapsRESTToolkit.csproj", "{AC15CCAC-63B7-43EB-A1CB-25925F04398B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Console", "Console", "{80170A9E-5ACF-483A-8A8E-18CA7B0C9A34}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RESTToolkitTestConsoleApp", "Samples\Console\RESTToolkitTestConsoleApp\RESTToolkitTestConsoleApp.csproj", "{3BE4FCCE-768A-4ABE-AF3E-938B5D884AC8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -36,6 +40,10 @@ Global
|
|||
{AC15CCAC-63B7-43EB-A1CB-25925F04398B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AC15CCAC-63B7-43EB-A1CB-25925F04398B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AC15CCAC-63B7-43EB-A1CB-25925F04398B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3BE4FCCE-768A-4ABE-AF3E-938B5D884AC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3BE4FCCE-768A-4ABE-AF3E-938B5D884AC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3BE4FCCE-768A-4ABE-AF3E-938B5D884AC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3BE4FCCE-768A-4ABE-AF3E-938B5D884AC8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -44,5 +52,7 @@ Global
|
|||
{26E65B0F-9554-408A-95D4-BDEC52945FC3} = {EE7ACF1F-56D3-4A01-8262-A49A8B444639}
|
||||
{4E8E6F9A-14C5-4758-B96F-D18B5B923075} = {26E65B0F-9554-408A-95D4-BDEC52945FC3}
|
||||
{AC15CCAC-63B7-43EB-A1CB-25925F04398B} = {A155C82A-42DC-4206-8DA8-C9C8CC3BFFE2}
|
||||
{80170A9E-5ACF-483A-8A8E-18CA7B0C9A34} = {EE7ACF1F-56D3-4A01-8262-A49A8B444639}
|
||||
{3BE4FCCE-768A-4ABE-AF3E-938B5D884AC8} = {80170A9E-5ACF-483A-8A8E-18CA7B0C9A34}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>BingMapsRESTToolkit</id>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.0</version>
|
||||
<title>Bing Maps REST Services Toolkit</title>
|
||||
<authors>Microsoft</authors>
|
||||
<owners>microsoft bingmaps</owners>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
using BingMapsRESTToolkit;
|
||||
using System;
|
||||
|
||||
namespace RESTToolkitTestConsoleApp
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var r = ServiceManager.GetResponseAsync(new GeocodeRequest()
|
||||
{
|
||||
BingMapsKey = System.Configuration.ConfigurationManager.AppSettings.Get("BingMapsKey"),
|
||||
Query = "Seattle"
|
||||
}).GetAwaiter().GetResult();
|
||||
|
||||
if (r != null && r.ResourceSets != null &&
|
||||
r.ResourceSets.Length > 0 &&
|
||||
r.ResourceSets[0].Resources != null &&
|
||||
r.ResourceSets[0].Resources.Length > 0)
|
||||
{
|
||||
for (var i = 0; i < r.ResourceSets[0].Resources.Length; i++)
|
||||
{
|
||||
Console.WriteLine((r.ResourceSets[0].Resources[i] as Location).Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("No results found.");
|
||||
}
|
||||
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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("RESTToolkitTestConsoleApp")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RESTToolkitTestConsoleApp")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[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("3be4fcce-768a-4abe-af3e-938b5d884ac8")]
|
||||
|
||||
// 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")]
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.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>{3BE4FCCE-768A-4ABE-AF3E-938B5D884AC8}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>RESTToolkitTestConsoleApp</RootNamespace>
|
||||
<AssemblyName>RESTToolkitTestConsoleApp</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</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="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<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.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Source\BingMapsRESTToolkit.csproj">
|
||||
<Project>{ac15ccac-63b7-43eb-a1cb-25925f04398b}</Project>
|
||||
<Name>BingMapsRESTToolkit</Name>
|
||||
</ProjectReference>
|
||||
</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>
|
Загрузка…
Ссылка в новой задаче