function OnStart()
{
crp = app.CreateCrypt();
ShowDialog( "Hello World" );
}
function ShowDialog( data )
{
app.ShowTextDialog("input text", data, OnText);
}
function OnText( text )
{
var dlg = app.CreateYesNoDialog( "Choose option", "NoCancel" );
dlg.SetOnTouch( OnAction );
dlg.data.text = text;
dlg.Show();
dlg.SetButtonText( "Encrypt", "Decrypt" );
}
function OnAction( result )
{
if( result == "Yes" )
{
result = crp.Encrypt( this.data.text, app.GetDeviceId() );
ShowDialog( result );
}
else if( result == "No" )
{
result = crp.Decrypt( this.data.text, app.GetDeviceId() );
ShowDialog( result );
}
}
from native import app
def OnStart():
global crp
crp = app.CreateCrypt()
ShowDialog("Hello World")
def ShowDialog(data):
app.ShowTextDialog("input text", data, OnText)
def OnText(text):
global data
dlg = app.CreateYesNoDialog("Choose option", "NoCancel")
dlg.SetOnTouch(OnAction)
dlg.data = {"text": text}
dlg.Show()
dlg.SetButtonText("Encrypt", "Decrypt")
def OnAction(result):
if result == "Yes":
result = crp.Encrypt(this.data["text"], app.GetDeviceId())
ShowDialog(result)
elif result == "No":
result = crp.Decrypt(this.data["text"], app.GetDeviceId())
ShowDialog(result)