Windows 8.1/Windows Phone 8.1 Platform

This topic explains the prerequisites, the process of including and using Tally Authentication Library in the Windows 8.1 application project, and the available API/methods.

Prerequisites

1. Add the required images in images folder. If it is a universal application, create the images folder in the shared part.

2. Enable support for toast notifications from the manifest file, Package.appxmanifest. Toast notifications provide messages during the authentication process to users in an unobtrusive manner. In universal applications, this is done individually for both Windows 8.1 and Windows Phone 8.1 application.

Configuration of Package.appxmanifest file is shown below:

Including the Library in Windows Project

Add the library as a reference to your project using Add Reference option, by right-clicking the project. In universal applications, this is done individually for both Windows 8.1 and Windows Phone 8.1 application.

Adding library using Add Reference option is shown below:

Using the Library in Windows Project

1. To include the library

using TallyAuthenticationLibrary;

2. To initialize the library

TallyLoginService ls;

public MainPage()

{

this .InitializeComponent();

ls = new TallyLoginService ();

trrm = new TestRequestResponseMgr ();

}

3. To invoke the login page (offline and online mode)

// Handles Online login button click

private void PerformOfflineAuth( object sender, RoutedEventArgs e)

{

PerformAuth( false );

}

// Handles Online login button click

private void PerformOnlineAuth( object sender, RoutedEventArgs e)

{

PerformAuth( true );

}

//Performs login as per mode selected

private void PerformAuth( Boolean pIsOnlineFlag)

{

ls.SetDeveloperMode( true );

ls.SetLoginModeOnline(pIsOnlineFlag);

ls.ShowLoginPage();

}

4. To use the response from the login page

//View authentication success result

private async void ViewAuthData( object sender, RoutedEventArgs e)

{

string user_msg = "" ;

try

{

dict = new Dictionary < string , string >();

dict = ls.GetLoginData();

user msg = "Status : " + dict["Status"] + "\nSession ID :" +

dict["SessionID"] +"\nTallyNET ID :" + dict["TallyNetId"] +

"\nError code & Desc :" + dict["ErrorCode"] + " " +

dict["ErrorMessage"];

}

catch (System.Collections.Generic. KeyNotFoundException )

{

user_msg = "No data found. Please login." ;

}

await ShowMessageDialog(user_msg);

API/Methods Provided

API/Methods

Purpose

void SetDeveloperMode(bool pIsDevMode)

To set the developer mode for the library.

In developer mode, library points to the test server .

void SetLoginModeOnline(bool pIsOnlineFlag)

To set the mode (online/offline) in which the library operates.

If not set, by default the library operates in offline environment.

bool GetLoginMode()

T o return the login mode

True – Online

False – Offline

void ShowLoginPage()

To show the login page, in the mode set using SetLoginModeOnline API.

Used to authenticate Tally.NET User ID against Tally.NET Server.

Dictionary <string, string> GetLoginData()

To get the authentication data from the library. This provides a dictionary with status, session ID, Tally.NET ID, error code and description.

string GetLoginLibraryVersion()

To get the current version of the library.