├── README.md ├── App.config ├── Service References └── TranslatorService │ ├── CSharp_TranslateSample.TranslatorService.TranslateArrayResponse.datasource │ ├── CSharp_TranslateSample.TranslatorService.GetTranslationsResponse.datasource │ ├── CSharp_TranslateSample.TranslatorService.TranslateArray2Response.datasource │ ├── soap2.xsd │ ├── configuration.svcinfo │ ├── soap.xsd │ ├── Reference.svcmap │ ├── SoapService.wsdl │ ├── soap.wsdl │ ├── soap3.xsd │ ├── soap1.xsd │ ├── configuration91.svcinfo │ └── Reference.cs ├── CSharp-TranslateSample.sln ├── Properties └── AssemblyInfo.cs ├── Program.cs ├── .gitattributes ├── .gitignore ├── CSharp-TranslateSample.csproj └── AzureAuthToken.cs /README.md: -------------------------------------------------------------------------------- 1 | # GetAzureToken 2 | Very simple C# Example of a console application using the Translator Service. 3 | Shows use of the AzureAuthToken class to obtain a token and use it with the Translator service. 4 | -------------------------------------------------------------------------------- /App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Service References/TranslatorService/CSharp_TranslateSample.TranslatorService.TranslateArrayResponse.datasource: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | CSharp_TranslateSample.TranslatorService.TranslateArrayResponse, Service References.TranslatorService.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /Service References/TranslatorService/CSharp_TranslateSample.TranslatorService.GetTranslationsResponse.datasource: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | CSharp_TranslateSample.TranslatorService.GetTranslationsResponse, Service References.TranslatorService.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /Service References/TranslatorService/CSharp_TranslateSample.TranslatorService.TranslateArray2Response.datasource: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | CSharp_TranslateSample.TranslatorService.TranslateArray2Response, Service References.TranslatorService.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /Service References/TranslatorService/soap2.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CSharp-TranslateSample.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp-TranslateSample", "CSharp-TranslateSample.csproj", "{D5046B55-3EE5-4BCA-A765-9C1B991C1EFF}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D5046B55-3EE5-4BCA-A765-9C1B991C1EFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D5046B55-3EE5-4BCA-A765-9C1B991C1EFF}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D5046B55-3EE5-4BCA-A765-9C1B991C1EFF}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D5046B55-3EE5-4BCA-A765-9C1B991C1EFF}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CSharp-TranslateSample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CSharp-TranslateSample")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d5046b55-3ee5-4bca-a765-9c1b991c1eff")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Service References/TranslatorService/configuration.svcinfo: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Http; 4 | using System.Threading.Tasks; 5 | using Microsoft.Translator.API; 6 | 7 | namespace CSharp_TranslateSample 8 | { 9 | class Program 10 | { 11 | private const string SubscriptionKey = "your subscription key"; //Enter here the Key from your Microsoft Translator Text subscription on http://portal.azure.com 12 | 13 | static void Main(string[] args) 14 | { 15 | TranslateAsync().Wait(); 16 | Console.ReadKey(); 17 | } 18 | 19 | /// Demonstrates getting an access token and using the token to translate. 20 | private static async Task TranslateAsync() 21 | { 22 | var translatorService = new TranslatorService.LanguageServiceClient(); 23 | var authTokenSource = new AzureAuthToken(SubscriptionKey); 24 | var token = string.Empty; 25 | 26 | try 27 | { 28 | token = await authTokenSource.GetAccessTokenAsync(); 29 | } 30 | catch (HttpRequestException) 31 | { 32 | switch (authTokenSource.RequestStatusCode) 33 | { 34 | case HttpStatusCode.Unauthorized: 35 | Console.WriteLine("Request to token service is not authorized (401). Check that the Azure subscription key is valid."); 36 | break; 37 | case HttpStatusCode.Forbidden: 38 | Console.WriteLine("Request to token service is not authorized (403). For accounts in the free-tier, check that the account quota is not exceeded."); 39 | break; 40 | } 41 | throw; 42 | } 43 | 44 | Console.WriteLine("Translated to French: {0}", translatorService.Translate(token, "Hello World", "en", "fr", "text/plain", "general", string.Empty)); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Service References/TranslatorService/soap.xsd: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Service References/TranslatorService/Reference.svcmap: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | true 6 | true 7 | 8 | false 9 | false 10 | false 11 | 12 | 13 | true 14 | Auto 15 | true 16 | true 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | [Xx]64/ 19 | [Xx]86/ 20 | [Bb]uild/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | 143 | # TODO: Un-comment the next line if you do not want to checkin 144 | # your web deploy settings because they may include unencrypted 145 | # passwords 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | # NuGet v3's project.json files produces more ignoreable files 158 | *.nuget.props 159 | *.nuget.targets 160 | 161 | # Microsoft Azure Build Output 162 | csx/ 163 | *.build.csdef 164 | 165 | # Microsoft Azure Emulator 166 | ecf/ 167 | rcf/ 168 | 169 | # Windows Store app package directory 170 | AppPackages/ 171 | BundleArtifacts/ 172 | 173 | # Visual Studio cache files 174 | # files ending in .cache can be ignored 175 | *.[Cc]ache 176 | # but keep track of directories ending in .cache 177 | !*.[Cc]ache/ 178 | 179 | # Others 180 | ClientBin/ 181 | [Ss]tyle[Cc]op.* 182 | ~$* 183 | *~ 184 | *.dbmdl 185 | *.dbproj.schemaview 186 | *.pfx 187 | *.publishsettings 188 | node_modules/ 189 | orleans.codegen.cs 190 | 191 | # RIA/Silverlight projects 192 | Generated_Code/ 193 | 194 | # Backup & report files from converting an old project file 195 | # to a newer Visual Studio version. Backup files are not needed, 196 | # because we have git ;-) 197 | _UpgradeReport_Files/ 198 | Backup*/ 199 | UpgradeLog*.XML 200 | UpgradeLog*.htm 201 | 202 | # SQL Server files 203 | *.mdf 204 | *.ldf 205 | 206 | # Business Intelligence projects 207 | *.rdl.data 208 | *.bim.layout 209 | *.bim_*.settings 210 | 211 | # Microsoft Fakes 212 | FakesAssemblies/ 213 | 214 | # GhostDoc plugin setting file 215 | *.GhostDoc.xml 216 | 217 | # Node.js Tools for Visual Studio 218 | .ntvs_analysis.dat 219 | 220 | # Visual Studio 6 build log 221 | *.plg 222 | 223 | # Visual Studio 6 workspace options file 224 | *.opt 225 | 226 | # Visual Studio LightSwitch build output 227 | **/*.HTMLClient/GeneratedArtifacts 228 | **/*.DesktopClient/GeneratedArtifacts 229 | **/*.DesktopClient/ModelManifest.xml 230 | **/*.Server/GeneratedArtifacts 231 | **/*.Server/ModelManifest.xml 232 | _Pvt_Extensions 233 | 234 | # LightSwitch generated files 235 | GeneratedArtifacts/ 236 | ModelManifest.xml 237 | 238 | # Paket dependency manager 239 | .paket/paket.exe 240 | 241 | # FAKE - F# Make 242 | .fake/ 243 | -------------------------------------------------------------------------------- /CSharp-TranslateSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D5046B55-3EE5-4BCA-A765-9C1B991C1EFF} 8 | Exe 9 | Properties 10 | CSharp_TranslateSample 11 | CSharp-TranslateSample 12 | v4.6.1 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | True 53 | True 54 | Reference.svcmap 55 | 56 | 57 | 58 | 59 | 60 | 61 | Reference.svcmap 62 | 63 | 64 | Reference.svcmap 65 | 66 | 67 | Reference.svcmap 68 | 69 | 70 | 71 | Designer 72 | 73 | 74 | Designer 75 | 76 | 77 | Designer 78 | 79 | 80 | Designer 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | WCF Proxy Generator 99 | Reference.cs 100 | 101 | 102 | 103 | 110 | -------------------------------------------------------------------------------- /AzureAuthToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Http; 4 | using System.Threading.Tasks; 5 | 6 | namespace Microsoft.Translator.API 7 | { 8 | /// 9 | /// Client to call Cognitive Services Azure Auth Token service in order to get an access token. 10 | /// Exposes asynchronous as well as synchronous methods. 11 | /// 12 | public class AzureAuthToken 13 | { 14 | /// URL of the token service 15 | private static readonly Uri ServiceUrl = new Uri("https://api.cognitive.microsoft.com/sts/v1.0/issueToken"); 16 | /// Name of header used to pass the subscription key to the token service 17 | private const string OcpApimSubscriptionKeyHeader = "Ocp-Apim-Subscription-Key"; 18 | /// After obtaining a valid token, this class will cache it for this duration. 19 | /// Use a duration of 5 minutes, which is less than the actual token lifetime of 10 minutes. 20 | private static readonly TimeSpan TokenCacheDuration = new TimeSpan(0, 5, 0); 21 | 22 | /// Cache the value of the last valid token obtained from the token service. 23 | private string storedTokenValue = string.Empty; 24 | /// When the last valid token was obtained. 25 | private DateTime storedTokenTime = DateTime.MinValue; 26 | 27 | /// Gets the subscription key. 28 | public string SubscriptionKey { get; private set; } = string.Empty; 29 | 30 | /// Gets the HTTP status code for the most recent request to the token service. 31 | public HttpStatusCode RequestStatusCode { get; private set; } 32 | 33 | /// 34 | /// Creates a client to obtain an access token. 35 | /// 36 | /// Subscription key to use to get an authentication token. 37 | public AzureAuthToken(string key) 38 | { 39 | if (string.IsNullOrEmpty(key)) 40 | { 41 | throw new ArgumentNullException("key", "A subscription key is required"); 42 | } 43 | 44 | this.SubscriptionKey = key; 45 | this.RequestStatusCode = HttpStatusCode.InternalServerError; 46 | } 47 | 48 | /// 49 | /// Gets a token for the specified subscription. 50 | /// 51 | /// The encoded JWT token prefixed with the string "Bearer ". 52 | /// 53 | /// This method uses a cache to limit the number of request to the token service. 54 | /// A fresh token can be re-used during its lifetime of 10 minutes. After a successful 55 | /// request to the token service, this method caches the access token. Subsequent 56 | /// invocations of the method return the cached token for the next 5 minutes. After 57 | /// 5 minutes, a new token is fetched from the token service and the cache is updated. 58 | /// 59 | public async Task GetAccessTokenAsync() 60 | { 61 | if (SubscriptionKey == string.Empty) return string.Empty; 62 | 63 | // Re-use the cached token if there is one. 64 | if ((DateTime.Now - storedTokenTime) < TokenCacheDuration) 65 | { 66 | return storedTokenValue; 67 | } 68 | 69 | using (var client = new HttpClient()) 70 | using (var request = new HttpRequestMessage()) 71 | { 72 | request.Method = HttpMethod.Post; 73 | request.RequestUri = ServiceUrl; 74 | request.Content = new StringContent(string.Empty); 75 | request.Headers.TryAddWithoutValidation(OcpApimSubscriptionKeyHeader, this.SubscriptionKey); 76 | client.Timeout = TimeSpan.FromSeconds(2); 77 | var response = await client.SendAsync(request); 78 | this.RequestStatusCode = response.StatusCode; 79 | response.EnsureSuccessStatusCode(); 80 | var token = await response.Content.ReadAsStringAsync(); 81 | storedTokenTime = DateTime.Now; 82 | storedTokenValue = "Bearer " + token; 83 | return storedTokenValue; 84 | } 85 | } 86 | 87 | /// 88 | /// Gets a token for the specified subscription. Synchronous version. 89 | /// Use of async version preferred 90 | /// 91 | /// The encoded JWT token prefixed with the string "Bearer ". 92 | /// 93 | /// This method uses a cache to limit the number of request to the token service. 94 | /// A fresh token can be re-used during its lifetime of 10 minutes. After a successful 95 | /// request to the token service, this method caches the access token. Subsequent 96 | /// invocations of the method return the cached token for the next 5 minutes. After 97 | /// 5 minutes, a new token is fetched from the token service and the cache is updated. 98 | /// 99 | public string GetAccessToken() 100 | { 101 | // Re-use the cached token if there is one. 102 | if ((DateTime.Now - storedTokenTime) < TokenCacheDuration) 103 | { 104 | return storedTokenValue; 105 | } 106 | 107 | string accessToken = null; 108 | var task = Task.Run(async () => 109 | { 110 | accessToken = await GetAccessTokenAsync(); 111 | }); 112 | 113 | while (!task.IsCompleted) 114 | { 115 | System.Threading.Thread.Yield(); 116 | } 117 | if (task.IsFaulted) 118 | { 119 | throw task.Exception; 120 | } 121 | else if (task.IsCanceled) 122 | { 123 | throw new Exception("Timeout obtaining access token."); 124 | } 125 | return accessToken; 126 | } 127 | 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /Service References/TranslatorService/SoapService.wsdl: -------------------------------------------------------------------------------- 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 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /Service References/TranslatorService/soap.wsdl: -------------------------------------------------------------------------------- 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 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /Service References/TranslatorService/soap3.xsd: -------------------------------------------------------------------------------- 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 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 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 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | -------------------------------------------------------------------------------- /Service References/TranslatorService/soap1.xsd: -------------------------------------------------------------------------------- 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 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 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 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | -------------------------------------------------------------------------------- /Service References/TranslatorService/configuration91.svcinfo: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | BasicHttpBinding_LanguageService 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | StrongWildcard 29 | 30 | 31 | 32 | 33 | 34 | 65536 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement 44 | 45 | 46 | 0 47 | 48 | 49 | 0 50 | 51 | 52 | 0 53 | 54 | 55 | 0 56 | 57 | 58 | 0 59 | 60 | 61 | System.Text.UTF8Encoding 62 | 63 | 64 | Buffered 65 | 66 | 67 | 68 | 69 | 70 | Text 71 | 72 | 73 | System.ServiceModel.Configuration.BasicHttpSecurityElement 74 | 75 | 76 | None 77 | 78 | 79 | System.ServiceModel.Configuration.HttpTransportSecurityElement 80 | 81 | 82 | None 83 | 84 | 85 | None 86 | 87 | 88 | System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement 89 | 90 | 91 | Never 92 | 93 | 94 | TransportSelected 95 | 96 | 97 | (Collection) 98 | 99 | 100 | 101 | 102 | 103 | System.ServiceModel.Configuration.BasicHttpMessageSecurityElement 104 | 105 | 106 | UserName 107 | 108 | 109 | Default 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | http://api.microsofttranslator.com/V2/soap.svc 119 | 120 | 121 | 122 | 123 | 124 | basicHttpBinding 125 | 126 | 127 | BasicHttpBinding_LanguageService 128 | 129 | 130 | TranslatorService.LanguageService 131 | 132 | 133 | System.ServiceModel.Configuration.AddressHeaderCollectionElement 134 | 135 | 136 | <Header /> 137 | 138 | 139 | System.ServiceModel.Configuration.IdentityElement 140 | 141 | 142 | System.ServiceModel.Configuration.UserPrincipalNameElement 143 | 144 | 145 | 146 | 147 | 148 | System.ServiceModel.Configuration.ServicePrincipalNameElement 149 | 150 | 151 | 152 | 153 | 154 | System.ServiceModel.Configuration.DnsElement 155 | 156 | 157 | 158 | 159 | 160 | System.ServiceModel.Configuration.RsaElement 161 | 162 | 163 | 164 | 165 | 166 | System.ServiceModel.Configuration.CertificateElement 167 | 168 | 169 | 170 | 171 | 172 | System.ServiceModel.Configuration.CertificateReferenceElement 173 | 174 | 175 | My 176 | 177 | 178 | LocalMachine 179 | 180 | 181 | FindBySubjectDistinguishedName 182 | 183 | 184 | 185 | 186 | 187 | False 188 | 189 | 190 | BasicHttpBinding_LanguageService 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | -------------------------------------------------------------------------------- /Service References/TranslatorService/Reference.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CSharp_TranslateSample.TranslatorService { 12 | using System.Runtime.Serialization; 13 | using System; 14 | 15 | 16 | [System.Diagnostics.DebuggerStepThroughAttribute()] 17 | [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 18 | [System.Runtime.Serialization.DataContractAttribute(Name="TranslateOptions", Namespace="http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2")] 19 | [System.SerializableAttribute()] 20 | public partial class TranslateOptions : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 21 | 22 | [System.NonSerializedAttribute()] 23 | private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 24 | 25 | [System.Runtime.Serialization.OptionalFieldAttribute()] 26 | private string CategoryField; 27 | 28 | [System.Runtime.Serialization.OptionalFieldAttribute()] 29 | private string ContentTypeField; 30 | 31 | [System.Runtime.Serialization.OptionalFieldAttribute()] 32 | private string GenderFromField; 33 | 34 | [System.Runtime.Serialization.OptionalFieldAttribute()] 35 | private string GenderToField; 36 | 37 | [System.Runtime.Serialization.OptionalFieldAttribute()] 38 | private bool IncludeMultipleMTAlternativesField; 39 | 40 | [System.Runtime.Serialization.OptionalFieldAttribute()] 41 | private string ProfanityActionField; 42 | 43 | [System.Runtime.Serialization.OptionalFieldAttribute()] 44 | private string ReservedFlagsField; 45 | 46 | [System.Runtime.Serialization.OptionalFieldAttribute()] 47 | private string StateField; 48 | 49 | [System.Runtime.Serialization.OptionalFieldAttribute()] 50 | private string UriField; 51 | 52 | [System.Runtime.Serialization.OptionalFieldAttribute()] 53 | private string UserField; 54 | 55 | [global::System.ComponentModel.BrowsableAttribute(false)] 56 | public System.Runtime.Serialization.ExtensionDataObject ExtensionData { 57 | get { 58 | return this.extensionDataField; 59 | } 60 | set { 61 | this.extensionDataField = value; 62 | } 63 | } 64 | 65 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 66 | public string Category { 67 | get { 68 | return this.CategoryField; 69 | } 70 | set { 71 | if ((object.ReferenceEquals(this.CategoryField, value) != true)) { 72 | this.CategoryField = value; 73 | this.RaisePropertyChanged("Category"); 74 | } 75 | } 76 | } 77 | 78 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 79 | public string ContentType { 80 | get { 81 | return this.ContentTypeField; 82 | } 83 | set { 84 | if ((object.ReferenceEquals(this.ContentTypeField, value) != true)) { 85 | this.ContentTypeField = value; 86 | this.RaisePropertyChanged("ContentType"); 87 | } 88 | } 89 | } 90 | 91 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 92 | public string GenderFrom { 93 | get { 94 | return this.GenderFromField; 95 | } 96 | set { 97 | if ((object.ReferenceEquals(this.GenderFromField, value) != true)) { 98 | this.GenderFromField = value; 99 | this.RaisePropertyChanged("GenderFrom"); 100 | } 101 | } 102 | } 103 | 104 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 105 | public string GenderTo { 106 | get { 107 | return this.GenderToField; 108 | } 109 | set { 110 | if ((object.ReferenceEquals(this.GenderToField, value) != true)) { 111 | this.GenderToField = value; 112 | this.RaisePropertyChanged("GenderTo"); 113 | } 114 | } 115 | } 116 | 117 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 118 | public bool IncludeMultipleMTAlternatives { 119 | get { 120 | return this.IncludeMultipleMTAlternativesField; 121 | } 122 | set { 123 | if ((this.IncludeMultipleMTAlternativesField.Equals(value) != true)) { 124 | this.IncludeMultipleMTAlternativesField = value; 125 | this.RaisePropertyChanged("IncludeMultipleMTAlternatives"); 126 | } 127 | } 128 | } 129 | 130 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 131 | public string ProfanityAction { 132 | get { 133 | return this.ProfanityActionField; 134 | } 135 | set { 136 | if ((object.ReferenceEquals(this.ProfanityActionField, value) != true)) { 137 | this.ProfanityActionField = value; 138 | this.RaisePropertyChanged("ProfanityAction"); 139 | } 140 | } 141 | } 142 | 143 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 144 | public string ReservedFlags { 145 | get { 146 | return this.ReservedFlagsField; 147 | } 148 | set { 149 | if ((object.ReferenceEquals(this.ReservedFlagsField, value) != true)) { 150 | this.ReservedFlagsField = value; 151 | this.RaisePropertyChanged("ReservedFlags"); 152 | } 153 | } 154 | } 155 | 156 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 157 | public string State { 158 | get { 159 | return this.StateField; 160 | } 161 | set { 162 | if ((object.ReferenceEquals(this.StateField, value) != true)) { 163 | this.StateField = value; 164 | this.RaisePropertyChanged("State"); 165 | } 166 | } 167 | } 168 | 169 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 170 | public string Uri { 171 | get { 172 | return this.UriField; 173 | } 174 | set { 175 | if ((object.ReferenceEquals(this.UriField, value) != true)) { 176 | this.UriField = value; 177 | this.RaisePropertyChanged("Uri"); 178 | } 179 | } 180 | } 181 | 182 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 183 | public string User { 184 | get { 185 | return this.UserField; 186 | } 187 | set { 188 | if ((object.ReferenceEquals(this.UserField, value) != true)) { 189 | this.UserField = value; 190 | this.RaisePropertyChanged("User"); 191 | } 192 | } 193 | } 194 | 195 | public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 196 | 197 | protected void RaisePropertyChanged(string propertyName) { 198 | System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; 199 | if ((propertyChanged != null)) { 200 | propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 201 | } 202 | } 203 | } 204 | 205 | [System.Diagnostics.DebuggerStepThroughAttribute()] 206 | [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 207 | [System.Runtime.Serialization.DataContractAttribute(Name="GetTranslationsResponse", Namespace="http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2")] 208 | [System.SerializableAttribute()] 209 | public partial class GetTranslationsResponse : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 210 | 211 | [System.NonSerializedAttribute()] 212 | private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 213 | 214 | [System.Runtime.Serialization.OptionalFieldAttribute()] 215 | private string FromField; 216 | 217 | [System.Runtime.Serialization.OptionalFieldAttribute()] 218 | private string StateField; 219 | 220 | [System.Runtime.Serialization.OptionalFieldAttribute()] 221 | private CSharp_TranslateSample.TranslatorService.TranslationMatch[] TranslationsField; 222 | 223 | [global::System.ComponentModel.BrowsableAttribute(false)] 224 | public System.Runtime.Serialization.ExtensionDataObject ExtensionData { 225 | get { 226 | return this.extensionDataField; 227 | } 228 | set { 229 | this.extensionDataField = value; 230 | } 231 | } 232 | 233 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 234 | public string From { 235 | get { 236 | return this.FromField; 237 | } 238 | set { 239 | if ((object.ReferenceEquals(this.FromField, value) != true)) { 240 | this.FromField = value; 241 | this.RaisePropertyChanged("From"); 242 | } 243 | } 244 | } 245 | 246 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 247 | public string State { 248 | get { 249 | return this.StateField; 250 | } 251 | set { 252 | if ((object.ReferenceEquals(this.StateField, value) != true)) { 253 | this.StateField = value; 254 | this.RaisePropertyChanged("State"); 255 | } 256 | } 257 | } 258 | 259 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 260 | public CSharp_TranslateSample.TranslatorService.TranslationMatch[] Translations { 261 | get { 262 | return this.TranslationsField; 263 | } 264 | set { 265 | if ((object.ReferenceEquals(this.TranslationsField, value) != true)) { 266 | this.TranslationsField = value; 267 | this.RaisePropertyChanged("Translations"); 268 | } 269 | } 270 | } 271 | 272 | public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 273 | 274 | protected void RaisePropertyChanged(string propertyName) { 275 | System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; 276 | if ((propertyChanged != null)) { 277 | propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 278 | } 279 | } 280 | } 281 | 282 | [System.Diagnostics.DebuggerStepThroughAttribute()] 283 | [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 284 | [System.Runtime.Serialization.DataContractAttribute(Name="TranslationMatch", Namespace="http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2")] 285 | [System.SerializableAttribute()] 286 | public partial class TranslationMatch : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 287 | 288 | [System.NonSerializedAttribute()] 289 | private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 290 | 291 | private int CountField; 292 | 293 | [System.Runtime.Serialization.OptionalFieldAttribute()] 294 | private string ErrorField; 295 | 296 | private int MatchDegreeField; 297 | 298 | [System.Runtime.Serialization.OptionalFieldAttribute()] 299 | private string MatchedOriginalTextField; 300 | 301 | private int RatingField; 302 | 303 | private string TranslatedTextField; 304 | 305 | [global::System.ComponentModel.BrowsableAttribute(false)] 306 | public System.Runtime.Serialization.ExtensionDataObject ExtensionData { 307 | get { 308 | return this.extensionDataField; 309 | } 310 | set { 311 | this.extensionDataField = value; 312 | } 313 | } 314 | 315 | [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)] 316 | public int Count { 317 | get { 318 | return this.CountField; 319 | } 320 | set { 321 | if ((this.CountField.Equals(value) != true)) { 322 | this.CountField = value; 323 | this.RaisePropertyChanged("Count"); 324 | } 325 | } 326 | } 327 | 328 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 329 | public string Error { 330 | get { 331 | return this.ErrorField; 332 | } 333 | set { 334 | if ((object.ReferenceEquals(this.ErrorField, value) != true)) { 335 | this.ErrorField = value; 336 | this.RaisePropertyChanged("Error"); 337 | } 338 | } 339 | } 340 | 341 | [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)] 342 | public int MatchDegree { 343 | get { 344 | return this.MatchDegreeField; 345 | } 346 | set { 347 | if ((this.MatchDegreeField.Equals(value) != true)) { 348 | this.MatchDegreeField = value; 349 | this.RaisePropertyChanged("MatchDegree"); 350 | } 351 | } 352 | } 353 | 354 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 355 | public string MatchedOriginalText { 356 | get { 357 | return this.MatchedOriginalTextField; 358 | } 359 | set { 360 | if ((object.ReferenceEquals(this.MatchedOriginalTextField, value) != true)) { 361 | this.MatchedOriginalTextField = value; 362 | this.RaisePropertyChanged("MatchedOriginalText"); 363 | } 364 | } 365 | } 366 | 367 | [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)] 368 | public int Rating { 369 | get { 370 | return this.RatingField; 371 | } 372 | set { 373 | if ((this.RatingField.Equals(value) != true)) { 374 | this.RatingField = value; 375 | this.RaisePropertyChanged("Rating"); 376 | } 377 | } 378 | } 379 | 380 | [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)] 381 | public string TranslatedText { 382 | get { 383 | return this.TranslatedTextField; 384 | } 385 | set { 386 | if ((object.ReferenceEquals(this.TranslatedTextField, value) != true)) { 387 | this.TranslatedTextField = value; 388 | this.RaisePropertyChanged("TranslatedText"); 389 | } 390 | } 391 | } 392 | 393 | public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 394 | 395 | protected void RaisePropertyChanged(string propertyName) { 396 | System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; 397 | if ((propertyChanged != null)) { 398 | propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 399 | } 400 | } 401 | } 402 | 403 | [System.Diagnostics.DebuggerStepThroughAttribute()] 404 | [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 405 | [System.Runtime.Serialization.DataContractAttribute(Name="Translation", Namespace="http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2")] 406 | [System.SerializableAttribute()] 407 | public partial class Translation : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 408 | 409 | [System.NonSerializedAttribute()] 410 | private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 411 | 412 | private string OriginalTextField; 413 | 414 | [System.Runtime.Serialization.OptionalFieldAttribute()] 415 | private int RatingField; 416 | 417 | [System.Runtime.Serialization.OptionalFieldAttribute()] 418 | private int SequenceField; 419 | 420 | private string TranslatedTextField; 421 | 422 | [global::System.ComponentModel.BrowsableAttribute(false)] 423 | public System.Runtime.Serialization.ExtensionDataObject ExtensionData { 424 | get { 425 | return this.extensionDataField; 426 | } 427 | set { 428 | this.extensionDataField = value; 429 | } 430 | } 431 | 432 | [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)] 433 | public string OriginalText { 434 | get { 435 | return this.OriginalTextField; 436 | } 437 | set { 438 | if ((object.ReferenceEquals(this.OriginalTextField, value) != true)) { 439 | this.OriginalTextField = value; 440 | this.RaisePropertyChanged("OriginalText"); 441 | } 442 | } 443 | } 444 | 445 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 446 | public int Rating { 447 | get { 448 | return this.RatingField; 449 | } 450 | set { 451 | if ((this.RatingField.Equals(value) != true)) { 452 | this.RatingField = value; 453 | this.RaisePropertyChanged("Rating"); 454 | } 455 | } 456 | } 457 | 458 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 459 | public int Sequence { 460 | get { 461 | return this.SequenceField; 462 | } 463 | set { 464 | if ((this.SequenceField.Equals(value) != true)) { 465 | this.SequenceField = value; 466 | this.RaisePropertyChanged("Sequence"); 467 | } 468 | } 469 | } 470 | 471 | [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)] 472 | public string TranslatedText { 473 | get { 474 | return this.TranslatedTextField; 475 | } 476 | set { 477 | if ((object.ReferenceEquals(this.TranslatedTextField, value) != true)) { 478 | this.TranslatedTextField = value; 479 | this.RaisePropertyChanged("TranslatedText"); 480 | } 481 | } 482 | } 483 | 484 | public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 485 | 486 | protected void RaisePropertyChanged(string propertyName) { 487 | System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; 488 | if ((propertyChanged != null)) { 489 | propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 490 | } 491 | } 492 | } 493 | 494 | [System.Diagnostics.DebuggerStepThroughAttribute()] 495 | [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 496 | [System.Runtime.Serialization.DataContractAttribute(Name="TranslateArrayResponse", Namespace="http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2")] 497 | [System.SerializableAttribute()] 498 | public partial class TranslateArrayResponse : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 499 | 500 | [System.NonSerializedAttribute()] 501 | private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 502 | 503 | [System.Runtime.Serialization.OptionalFieldAttribute()] 504 | private string ErrorField; 505 | 506 | [System.Runtime.Serialization.OptionalFieldAttribute()] 507 | private string FromField; 508 | 509 | [System.Runtime.Serialization.OptionalFieldAttribute()] 510 | private int[] OriginalTextSentenceLengthsField; 511 | 512 | [System.Runtime.Serialization.OptionalFieldAttribute()] 513 | private string StateField; 514 | 515 | [System.Runtime.Serialization.OptionalFieldAttribute()] 516 | private string TranslatedTextField; 517 | 518 | [System.Runtime.Serialization.OptionalFieldAttribute()] 519 | private int[] TranslatedTextSentenceLengthsField; 520 | 521 | [global::System.ComponentModel.BrowsableAttribute(false)] 522 | public System.Runtime.Serialization.ExtensionDataObject ExtensionData { 523 | get { 524 | return this.extensionDataField; 525 | } 526 | set { 527 | this.extensionDataField = value; 528 | } 529 | } 530 | 531 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 532 | public string Error { 533 | get { 534 | return this.ErrorField; 535 | } 536 | set { 537 | if ((object.ReferenceEquals(this.ErrorField, value) != true)) { 538 | this.ErrorField = value; 539 | this.RaisePropertyChanged("Error"); 540 | } 541 | } 542 | } 543 | 544 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 545 | public string From { 546 | get { 547 | return this.FromField; 548 | } 549 | set { 550 | if ((object.ReferenceEquals(this.FromField, value) != true)) { 551 | this.FromField = value; 552 | this.RaisePropertyChanged("From"); 553 | } 554 | } 555 | } 556 | 557 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 558 | public int[] OriginalTextSentenceLengths { 559 | get { 560 | return this.OriginalTextSentenceLengthsField; 561 | } 562 | set { 563 | if ((object.ReferenceEquals(this.OriginalTextSentenceLengthsField, value) != true)) { 564 | this.OriginalTextSentenceLengthsField = value; 565 | this.RaisePropertyChanged("OriginalTextSentenceLengths"); 566 | } 567 | } 568 | } 569 | 570 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 571 | public string State { 572 | get { 573 | return this.StateField; 574 | } 575 | set { 576 | if ((object.ReferenceEquals(this.StateField, value) != true)) { 577 | this.StateField = value; 578 | this.RaisePropertyChanged("State"); 579 | } 580 | } 581 | } 582 | 583 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 584 | public string TranslatedText { 585 | get { 586 | return this.TranslatedTextField; 587 | } 588 | set { 589 | if ((object.ReferenceEquals(this.TranslatedTextField, value) != true)) { 590 | this.TranslatedTextField = value; 591 | this.RaisePropertyChanged("TranslatedText"); 592 | } 593 | } 594 | } 595 | 596 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 597 | public int[] TranslatedTextSentenceLengths { 598 | get { 599 | return this.TranslatedTextSentenceLengthsField; 600 | } 601 | set { 602 | if ((object.ReferenceEquals(this.TranslatedTextSentenceLengthsField, value) != true)) { 603 | this.TranslatedTextSentenceLengthsField = value; 604 | this.RaisePropertyChanged("TranslatedTextSentenceLengths"); 605 | } 606 | } 607 | } 608 | 609 | public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 610 | 611 | protected void RaisePropertyChanged(string propertyName) { 612 | System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; 613 | if ((propertyChanged != null)) { 614 | propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 615 | } 616 | } 617 | } 618 | 619 | [System.Diagnostics.DebuggerStepThroughAttribute()] 620 | [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 621 | [System.Runtime.Serialization.DataContractAttribute(Name="TranslateArray2Response", Namespace="http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2")] 622 | [System.SerializableAttribute()] 623 | public partial class TranslateArray2Response : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 624 | 625 | [System.NonSerializedAttribute()] 626 | private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 627 | 628 | [System.Runtime.Serialization.OptionalFieldAttribute()] 629 | private string AlignmentField; 630 | 631 | [System.Runtime.Serialization.OptionalFieldAttribute()] 632 | private string ErrorField; 633 | 634 | [System.Runtime.Serialization.OptionalFieldAttribute()] 635 | private string FromField; 636 | 637 | [System.Runtime.Serialization.OptionalFieldAttribute()] 638 | private int[] OriginalTextSentenceLengthsField; 639 | 640 | [System.Runtime.Serialization.OptionalFieldAttribute()] 641 | private string StateField; 642 | 643 | [System.Runtime.Serialization.OptionalFieldAttribute()] 644 | private string TranslatedTextField; 645 | 646 | [System.Runtime.Serialization.OptionalFieldAttribute()] 647 | private int[] TranslatedTextSentenceLengthsField; 648 | 649 | [global::System.ComponentModel.BrowsableAttribute(false)] 650 | public System.Runtime.Serialization.ExtensionDataObject ExtensionData { 651 | get { 652 | return this.extensionDataField; 653 | } 654 | set { 655 | this.extensionDataField = value; 656 | } 657 | } 658 | 659 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 660 | public string Alignment { 661 | get { 662 | return this.AlignmentField; 663 | } 664 | set { 665 | if ((object.ReferenceEquals(this.AlignmentField, value) != true)) { 666 | this.AlignmentField = value; 667 | this.RaisePropertyChanged("Alignment"); 668 | } 669 | } 670 | } 671 | 672 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 673 | public string Error { 674 | get { 675 | return this.ErrorField; 676 | } 677 | set { 678 | if ((object.ReferenceEquals(this.ErrorField, value) != true)) { 679 | this.ErrorField = value; 680 | this.RaisePropertyChanged("Error"); 681 | } 682 | } 683 | } 684 | 685 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 686 | public string From { 687 | get { 688 | return this.FromField; 689 | } 690 | set { 691 | if ((object.ReferenceEquals(this.FromField, value) != true)) { 692 | this.FromField = value; 693 | this.RaisePropertyChanged("From"); 694 | } 695 | } 696 | } 697 | 698 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 699 | public int[] OriginalTextSentenceLengths { 700 | get { 701 | return this.OriginalTextSentenceLengthsField; 702 | } 703 | set { 704 | if ((object.ReferenceEquals(this.OriginalTextSentenceLengthsField, value) != true)) { 705 | this.OriginalTextSentenceLengthsField = value; 706 | this.RaisePropertyChanged("OriginalTextSentenceLengths"); 707 | } 708 | } 709 | } 710 | 711 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 712 | public string State { 713 | get { 714 | return this.StateField; 715 | } 716 | set { 717 | if ((object.ReferenceEquals(this.StateField, value) != true)) { 718 | this.StateField = value; 719 | this.RaisePropertyChanged("State"); 720 | } 721 | } 722 | } 723 | 724 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 725 | public string TranslatedText { 726 | get { 727 | return this.TranslatedTextField; 728 | } 729 | set { 730 | if ((object.ReferenceEquals(this.TranslatedTextField, value) != true)) { 731 | this.TranslatedTextField = value; 732 | this.RaisePropertyChanged("TranslatedText"); 733 | } 734 | } 735 | } 736 | 737 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)] 738 | public int[] TranslatedTextSentenceLengths { 739 | get { 740 | return this.TranslatedTextSentenceLengthsField; 741 | } 742 | set { 743 | if ((object.ReferenceEquals(this.TranslatedTextSentenceLengthsField, value) != true)) { 744 | this.TranslatedTextSentenceLengthsField = value; 745 | this.RaisePropertyChanged("TranslatedTextSentenceLengths"); 746 | } 747 | } 748 | } 749 | 750 | public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 751 | 752 | protected void RaisePropertyChanged(string propertyName) { 753 | System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; 754 | if ((propertyChanged != null)) { 755 | propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 756 | } 757 | } 758 | } 759 | 760 | [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] 761 | [System.ServiceModel.ServiceContractAttribute(Namespace="http://api.microsofttranslator.com/V2", ConfigurationName="TranslatorService.LanguageService")] 762 | public interface LanguageService { 763 | 764 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/AddTranslation", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/AddTranslationResponse")] 765 | void AddTranslation(string appId, string originalText, string translatedText, string from, string to, int rating, string contentType, string category, string user, string uri); 766 | 767 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/AddTranslation", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/AddTranslationResponse")] 768 | System.Threading.Tasks.Task AddTranslationAsync(string appId, string originalText, string translatedText, string from, string to, int rating, string contentType, string category, string user, string uri); 769 | 770 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/BreakSentences", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/BreakSentencesResponse")] 771 | int[] BreakSentences(string appId, string text, string language); 772 | 773 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/BreakSentences", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/BreakSentencesResponse")] 774 | System.Threading.Tasks.Task BreakSentencesAsync(string appId, string text, string language); 775 | 776 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/Detect", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/DetectResponse")] 777 | string Detect(string appId, string text); 778 | 779 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/Detect", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/DetectResponse")] 780 | System.Threading.Tasks.Task DetectAsync(string appId, string text); 781 | 782 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/DetectArray", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/DetectArrayResponse")] 783 | string[] DetectArray(string appId, string[] texts); 784 | 785 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/DetectArray", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/DetectArrayResponse")] 786 | System.Threading.Tasks.Task DetectArrayAsync(string appId, string[] texts); 787 | 788 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetAppIdToken", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetAppIdTokenResponse")] 789 | string GetAppIdToken(string appId, int minRatingRead, int maxRatingWrite, int expireSeconds); 790 | 791 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetAppIdToken", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetAppIdTokenResponse")] 792 | System.Threading.Tasks.Task GetAppIdTokenAsync(string appId, int minRatingRead, int maxRatingWrite, int expireSeconds); 793 | 794 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetLanguageNames", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetLanguageNamesResponse")] 795 | string[] GetLanguageNames(string appId, string locale, string[] languageCodes, bool useSpokenVariant); 796 | 797 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetLanguageNames", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetLanguageNamesResponse")] 798 | System.Threading.Tasks.Task GetLanguageNamesAsync(string appId, string locale, string[] languageCodes, bool useSpokenVariant); 799 | 800 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetLanguagesForSpeak", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetLanguagesForSpeakRespons" + 801 | "e")] 802 | string[] GetLanguagesForSpeak(string appId); 803 | 804 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetLanguagesForSpeak", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetLanguagesForSpeakRespons" + 805 | "e")] 806 | System.Threading.Tasks.Task GetLanguagesForSpeakAsync(string appId); 807 | 808 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetLanguagesForTranslate", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetLanguagesForTranslateRes" + 809 | "ponse")] 810 | string[] GetLanguagesForTranslate(string appId); 811 | 812 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetLanguagesForTranslate", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetLanguagesForTranslateRes" + 813 | "ponse")] 814 | System.Threading.Tasks.Task GetLanguagesForTranslateAsync(string appId); 815 | 816 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetTranslations", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetTranslationsResponse")] 817 | CSharp_TranslateSample.TranslatorService.GetTranslationsResponse GetTranslations(string appId, string text, string from, string to, int maxTranslations, CSharp_TranslateSample.TranslatorService.TranslateOptions options); 818 | 819 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetTranslations", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetTranslationsResponse")] 820 | System.Threading.Tasks.Task GetTranslationsAsync(string appId, string text, string from, string to, int maxTranslations, CSharp_TranslateSample.TranslatorService.TranslateOptions options); 821 | 822 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/Translate", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/TranslateResponse")] 823 | string Translate(string appId, string text, string from, string to, string contentType, string category, string reservedFlags); 824 | 825 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/Translate", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/TranslateResponse")] 826 | System.Threading.Tasks.Task TranslateAsync(string appId, string text, string from, string to, string contentType, string category, string reservedFlags); 827 | 828 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/AddTranslationArray", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/AddTranslationArrayResponse" + 829 | "")] 830 | void AddTranslationArray(string appId, CSharp_TranslateSample.TranslatorService.Translation[] translations, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options); 831 | 832 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/AddTranslationArray", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/AddTranslationArrayResponse" + 833 | "")] 834 | System.Threading.Tasks.Task AddTranslationArrayAsync(string appId, CSharp_TranslateSample.TranslatorService.Translation[] translations, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options); 835 | 836 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetTranslationsArray", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetTranslationsArrayRespons" + 837 | "e")] 838 | CSharp_TranslateSample.TranslatorService.GetTranslationsResponse[] GetTranslationsArray(string appId, string[] texts, string from, string to, int maxTranslations, CSharp_TranslateSample.TranslatorService.TranslateOptions options); 839 | 840 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/GetTranslationsArray", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/GetTranslationsArrayRespons" + 841 | "e")] 842 | System.Threading.Tasks.Task GetTranslationsArrayAsync(string appId, string[] texts, string from, string to, int maxTranslations, CSharp_TranslateSample.TranslatorService.TranslateOptions options); 843 | 844 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/Speak", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/SpeakResponse")] 845 | string Speak(string appId, string text, string language, string format, string options); 846 | 847 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/Speak", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/SpeakResponse")] 848 | System.Threading.Tasks.Task SpeakAsync(string appId, string text, string language, string format, string options); 849 | 850 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/TranslateArray", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/TranslateArrayResponse")] 851 | CSharp_TranslateSample.TranslatorService.TranslateArrayResponse[] TranslateArray(string appId, string[] texts, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options); 852 | 853 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/TranslateArray", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/TranslateArrayResponse")] 854 | System.Threading.Tasks.Task TranslateArrayAsync(string appId, string[] texts, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options); 855 | 856 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/TranslateArray2", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/TranslateArray2Response")] 857 | CSharp_TranslateSample.TranslatorService.TranslateArray2Response[] TranslateArray2(string appId, string[] texts, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options); 858 | 859 | [System.ServiceModel.OperationContractAttribute(Action="http://api.microsofttranslator.com/V2/LanguageService/TranslateArray2", ReplyAction="http://api.microsofttranslator.com/V2/LanguageService/TranslateArray2Response")] 860 | System.Threading.Tasks.Task TranslateArray2Async(string appId, string[] texts, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options); 861 | } 862 | 863 | [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] 864 | public interface LanguageServiceChannel : CSharp_TranslateSample.TranslatorService.LanguageService, System.ServiceModel.IClientChannel { 865 | } 866 | 867 | [System.Diagnostics.DebuggerStepThroughAttribute()] 868 | [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] 869 | public partial class LanguageServiceClient : System.ServiceModel.ClientBase, CSharp_TranslateSample.TranslatorService.LanguageService { 870 | 871 | public LanguageServiceClient() { 872 | } 873 | 874 | public LanguageServiceClient(string endpointConfigurationName) : 875 | base(endpointConfigurationName) { 876 | } 877 | 878 | public LanguageServiceClient(string endpointConfigurationName, string remoteAddress) : 879 | base(endpointConfigurationName, remoteAddress) { 880 | } 881 | 882 | public LanguageServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 883 | base(endpointConfigurationName, remoteAddress) { 884 | } 885 | 886 | public LanguageServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 887 | base(binding, remoteAddress) { 888 | } 889 | 890 | public void AddTranslation(string appId, string originalText, string translatedText, string from, string to, int rating, string contentType, string category, string user, string uri) { 891 | base.Channel.AddTranslation(appId, originalText, translatedText, from, to, rating, contentType, category, user, uri); 892 | } 893 | 894 | public System.Threading.Tasks.Task AddTranslationAsync(string appId, string originalText, string translatedText, string from, string to, int rating, string contentType, string category, string user, string uri) { 895 | return base.Channel.AddTranslationAsync(appId, originalText, translatedText, from, to, rating, contentType, category, user, uri); 896 | } 897 | 898 | public int[] BreakSentences(string appId, string text, string language) { 899 | return base.Channel.BreakSentences(appId, text, language); 900 | } 901 | 902 | public System.Threading.Tasks.Task BreakSentencesAsync(string appId, string text, string language) { 903 | return base.Channel.BreakSentencesAsync(appId, text, language); 904 | } 905 | 906 | public string Detect(string appId, string text) { 907 | return base.Channel.Detect(appId, text); 908 | } 909 | 910 | public System.Threading.Tasks.Task DetectAsync(string appId, string text) { 911 | return base.Channel.DetectAsync(appId, text); 912 | } 913 | 914 | public string[] DetectArray(string appId, string[] texts) { 915 | return base.Channel.DetectArray(appId, texts); 916 | } 917 | 918 | public System.Threading.Tasks.Task DetectArrayAsync(string appId, string[] texts) { 919 | return base.Channel.DetectArrayAsync(appId, texts); 920 | } 921 | 922 | public string GetAppIdToken(string appId, int minRatingRead, int maxRatingWrite, int expireSeconds) { 923 | return base.Channel.GetAppIdToken(appId, minRatingRead, maxRatingWrite, expireSeconds); 924 | } 925 | 926 | public System.Threading.Tasks.Task GetAppIdTokenAsync(string appId, int minRatingRead, int maxRatingWrite, int expireSeconds) { 927 | return base.Channel.GetAppIdTokenAsync(appId, minRatingRead, maxRatingWrite, expireSeconds); 928 | } 929 | 930 | public string[] GetLanguageNames(string appId, string locale, string[] languageCodes, bool useSpokenVariant) { 931 | return base.Channel.GetLanguageNames(appId, locale, languageCodes, useSpokenVariant); 932 | } 933 | 934 | public System.Threading.Tasks.Task GetLanguageNamesAsync(string appId, string locale, string[] languageCodes, bool useSpokenVariant) { 935 | return base.Channel.GetLanguageNamesAsync(appId, locale, languageCodes, useSpokenVariant); 936 | } 937 | 938 | public string[] GetLanguagesForSpeak(string appId) { 939 | return base.Channel.GetLanguagesForSpeak(appId); 940 | } 941 | 942 | public System.Threading.Tasks.Task GetLanguagesForSpeakAsync(string appId) { 943 | return base.Channel.GetLanguagesForSpeakAsync(appId); 944 | } 945 | 946 | public string[] GetLanguagesForTranslate(string appId) { 947 | return base.Channel.GetLanguagesForTranslate(appId); 948 | } 949 | 950 | public System.Threading.Tasks.Task GetLanguagesForTranslateAsync(string appId) { 951 | return base.Channel.GetLanguagesForTranslateAsync(appId); 952 | } 953 | 954 | public CSharp_TranslateSample.TranslatorService.GetTranslationsResponse GetTranslations(string appId, string text, string from, string to, int maxTranslations, CSharp_TranslateSample.TranslatorService.TranslateOptions options) { 955 | return base.Channel.GetTranslations(appId, text, from, to, maxTranslations, options); 956 | } 957 | 958 | public System.Threading.Tasks.Task GetTranslationsAsync(string appId, string text, string from, string to, int maxTranslations, CSharp_TranslateSample.TranslatorService.TranslateOptions options) { 959 | return base.Channel.GetTranslationsAsync(appId, text, from, to, maxTranslations, options); 960 | } 961 | 962 | public string Translate(string appId, string text, string from, string to, string contentType, string category, string reservedFlags) { 963 | return base.Channel.Translate(appId, text, from, to, contentType, category, reservedFlags); 964 | } 965 | 966 | public System.Threading.Tasks.Task TranslateAsync(string appId, string text, string from, string to, string contentType, string category, string reservedFlags) { 967 | return base.Channel.TranslateAsync(appId, text, from, to, contentType, category, reservedFlags); 968 | } 969 | 970 | public void AddTranslationArray(string appId, CSharp_TranslateSample.TranslatorService.Translation[] translations, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options) { 971 | base.Channel.AddTranslationArray(appId, translations, from, to, options); 972 | } 973 | 974 | public System.Threading.Tasks.Task AddTranslationArrayAsync(string appId, CSharp_TranslateSample.TranslatorService.Translation[] translations, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options) { 975 | return base.Channel.AddTranslationArrayAsync(appId, translations, from, to, options); 976 | } 977 | 978 | public CSharp_TranslateSample.TranslatorService.GetTranslationsResponse[] GetTranslationsArray(string appId, string[] texts, string from, string to, int maxTranslations, CSharp_TranslateSample.TranslatorService.TranslateOptions options) { 979 | return base.Channel.GetTranslationsArray(appId, texts, from, to, maxTranslations, options); 980 | } 981 | 982 | public System.Threading.Tasks.Task GetTranslationsArrayAsync(string appId, string[] texts, string from, string to, int maxTranslations, CSharp_TranslateSample.TranslatorService.TranslateOptions options) { 983 | return base.Channel.GetTranslationsArrayAsync(appId, texts, from, to, maxTranslations, options); 984 | } 985 | 986 | public string Speak(string appId, string text, string language, string format, string options) { 987 | return base.Channel.Speak(appId, text, language, format, options); 988 | } 989 | 990 | public System.Threading.Tasks.Task SpeakAsync(string appId, string text, string language, string format, string options) { 991 | return base.Channel.SpeakAsync(appId, text, language, format, options); 992 | } 993 | 994 | public CSharp_TranslateSample.TranslatorService.TranslateArrayResponse[] TranslateArray(string appId, string[] texts, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options) { 995 | return base.Channel.TranslateArray(appId, texts, from, to, options); 996 | } 997 | 998 | public System.Threading.Tasks.Task TranslateArrayAsync(string appId, string[] texts, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options) { 999 | return base.Channel.TranslateArrayAsync(appId, texts, from, to, options); 1000 | } 1001 | 1002 | public CSharp_TranslateSample.TranslatorService.TranslateArray2Response[] TranslateArray2(string appId, string[] texts, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options) { 1003 | return base.Channel.TranslateArray2(appId, texts, from, to, options); 1004 | } 1005 | 1006 | public System.Threading.Tasks.Task TranslateArray2Async(string appId, string[] texts, string from, string to, CSharp_TranslateSample.TranslatorService.TranslateOptions options) { 1007 | return base.Channel.TranslateArray2Async(appId, texts, from, to, options); 1008 | } 1009 | } 1010 | } 1011 | --------------------------------------------------------------------------------