C# Class LocalyticsSession, trellow

Mostra file Open project: Bunk/trellow Class Usage Examples

Public Methods

Method Description
Close ( ) : void

Closes the Localytics session.

GetAppVersion ( ) : string

Retreives the Application Version from teh WMAppManifest.xml file

LocalyticsSession ( string appKey ) : System

Creates a Localytics Session object

Open ( ) : void

Opens or resumes the Localytics session.

TagEvent ( string eventName, string>.Dictionary attributes = null ) : void

Records a specific event as having occured and optionally records some attributes associated with this event. This should not be called inside a loop. It should not be used to record personally identifiable information and it is best to define all your event names rather than generate them programatically.

Upload ( ) : void

Creates a new thread which collects any files and uploads them. Returns immediately if an upload is already happenning.

Private Methods

Method Description
BeginUpload ( ) : void

Runs on a seperate thread and is responsible for renaming and uploading files as appropriate

DeleteUploadFiles ( ) : void

loops through all the files in the directory deleting the upload files

EscapeString ( string input ) : string

Formats an input string for YAML

GetBlobHeader ( ) : string

Constructs a blob header for uploading

GetDatestring ( ) : string

Gets the current date/time as a string which can be inserted in the DB

GetDeviceId ( ) : string

Retreives a unique identifier for this device. According to Microsoft, this identifier is unique across all carriers and devices

GetFileContents ( string filename ) : string

Reads a file and returns its contents as a string

GetInstallId ( ) : string

Gets the Installation ID out of the metadata file

GetPersistStoreCreateTime ( ) : string

Gets the timestamp of the storage file containing the sequence numbers. This allows processing to ignore duplicates or identify missing uploads

GetSequenceNumber ( ) : string

Gets the sequence number for the next upload blob.

GetTimeInUnixTime ( ) : double

Gets the current time in unixtime

GetUploadContents ( ) : string

Goes through all the upload files and collects their contents for upload

LogMessage ( string msg ) : void

Outputs a message to the debug console

SetNextSequenceNumber ( string number ) : void

Sets the next sequence number in the metadata file. Creates the file if its not already there

appendTextToFile ( string text, string filename ) : void

Appends a string to the end of a text file

getNumberOfStoredSessions ( ) : int

Tallies up the number of files whose name starts w/ sessionFilePrefix in the localytics dir

getStore ( ) : IsolatedStorageFile

Caches the reference to the app's isolated storage

getStreamForFile ( string filename ) : IsolatedStorageFileStream

Gets a stream pointing to the requested file. If the file does not exist it is created. If the file does exist the stream points to the end of the file

renameOrAppendSessionFiles ( ) : void

Rename any open session files. This way events recorded during uploaded get written safely to disk and threading difficulties are missed.

Method Details

Close() public method

Closes the Localytics session.
public Close ( ) : void
return void

GetAppVersion() public static method

Retreives the Application Version from teh WMAppManifest.xml file
public static GetAppVersion ( ) : string
return string

LocalyticsSession() public method

Creates a Localytics Session object
public LocalyticsSession ( string appKey ) : System
appKey string The key unique for each application generated at www.localytics.com
return System

Open() public method

Opens or resumes the Localytics session.
public Open ( ) : void
return void

TagEvent() public method

Records a specific event as having occured and optionally records some attributes associated with this event. This should not be called inside a loop. It should not be used to record personally identifiable information and it is best to define all your event names rather than generate them programatically.
public TagEvent ( string eventName, string>.Dictionary attributes = null ) : void
eventName string The name of the event which occured. E.G. 'button pressed'
attributes string>.Dictionary Key value pairs that record data relevant to the event.
return void

Upload() public method

Creates a new thread which collects any files and uploads them. Returns immediately if an upload is already happenning.
public Upload ( ) : void
return void