C sharp tutorial in hindi and english pdf download






















You should now see a preview of the app's user interface in Visual Studio. It should look similar to the image above. That's it, your form is ready. In the next few sections, we're going to add code to populate our drop-down menus, and to call a handful of API exposed by Translator and Bing Spell Check.

All of our project is encapsulated in the MainWindow : Window class. Let's start by adding code to set your subscription key, declare endpoints for Translator and Bing Spell Check, and initialize the app.

In this code block, we've declared two member variables that contain information about available languages for translation:. Then, within the MainWindow constructor, we've added error handling with HandleExceptions. This error handling ensures that an alert is provided if an exception isn't handled. Then a check is run to confirm the subscription key provided is 32 characters in length.

If there are keys that are at least the right length, the InitializeComponent call gets the user interface rolling by locating, loading, and instantiating the XAML description of the main app window. Last, we've added code to call methods to retrieve languages for translation and to populate the drop-down menus for our app's user interface. Don't worry, we'll get to the code behind these calls soon. We recommend calling the Languages resource exposed by the Translator rather than hardcoding the language list in your app.

In this section, we'll create a GET request to the Languages resource, specifying that we want a list of languages available for translation. The Languages resource allows you to filter language support with the following query parameters: transliteration, dictionary, and translation.

For more information, see API reference. Before we go any further, let's take a look at a sample output for a call to the Languages resource:. From this output, we can extract the language code and the name of a specific language. Our app uses NewtonSoft. Picking up where we left off in the last section, let's add a method to get supported languages to our app. The Accept-Language header with the value en is added so that the supported languages are returned in English.

The JSON response is parsed and converted to a dictionary. Then the language codes are added to the languageCodes member variable. The drop-down menus in the form display the friendly names, but the codes are needed to request the translation. The one thing you need to do is add the friendly language names to the Translate from and Translate to drop-down menus. The PopulateLanguageMenus method adds the names.

This method iterates over the languageCodesAndTitles dictionary and adds each key to both menus. After the menus are populated, the default from and to languages are set to Detect and English respectively. Without a default selection for the menus, the user can click Translate without first choosing a "to" or "from" language. The defaults eliminate the need to deal with this problem.

Now that MainWindow has been initialized and the user interface created, this code won't run until the Translate button is clicked. Now we're going to create method to detect the language of the source text text entered into our text area using the Translator. The value returned by this request will be used in our translation request later.

It takes a single argument, text , which is passed along as the body of the request. Later, we when we create our translation request, the text entered into our UI will be passed to this method for language detection.

As previously mentioned, you can do some research and find other attractive PDF tutorials too. Computer PDF is here to help you learn programs, enhance your knowledge in computer security, databases, office, automation, analytics and IT in general.

Feel free to download our IT tutorials and guide documents and learn the joy of free learning. Office Word, Excel, Powerpoint Computer architecture hardware, Operatings systems Windows, linux Thanks a lot for the information. As you suggested I included my pdf as an embedded file in the resources, and then used the code.

However, even though this works fine in Win XP, when I try to run the application in Win 7 it returns the message that access to the pdf is denied. This is even though I am logged into the Win 7 machine as admin. Is there any reason that you know of for this to happen? I included this in a try-catch so that the catch in the Win 7 case reverts to the older method of calling the pdf from the website and opening it in a browser. While this older method works okay it takes much longer to open than embedding it as above.

I tried as you suggested to create fs SpecialFolder, and create the file in a local directory as below:. Start Environment. GetFolderPath Environment. As you say the first way should have worked fine i. However this works fine, and no harm to have the pdf stored on a known location. Ask a question. Quick access. Search related threads. Remove From My Forums.

Answered by:. Archived Forums. Visual C. Sign in to vote. Hi, At the moment, my application has a button when clicked opens a pdf from a web-site I would like to include a pdf. Monday, May 30, PM. Hi SWClarke,.



0コメント

  • 1000 / 1000