package keymon.lat.medicomed;

import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.pc.*;

public class c_updateavailable_subs_0 {


public static void  _b4xpage_appear(RemoteObject __ref) throws Exception{
try {
		Debug.PushSubsStack("B4XPage_Appear (c_updateavailable) ","c_updateavailable",19,__ref.getField(false, "ba"),__ref,18);
if (RapidSub.canDelegate("b4xpage_appear")) { __ref.runUserSub(false, "c_updateavailable","b4xpage_appear", __ref); return;}
ResumableSub_B4XPage_Appear rsub = new ResumableSub_B4XPage_Appear(null,__ref);
rsub.resume(null, null);
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static class ResumableSub_B4XPage_Appear extends BA.ResumableSub {
public ResumableSub_B4XPage_Appear(keymon.lat.medicomed.c_updateavailable parent,RemoteObject __ref) {
this.parent = parent;
this.__ref = __ref;
}
java.util.LinkedHashMap<String, Object> rsLocals = new java.util.LinkedHashMap<String, Object>();
RemoteObject __ref;
keymon.lat.medicomed.c_updateavailable parent;
RemoteObject _result = RemoteObject.createImmutable(0);
RemoteObject _in = RemoteObject.declareNull("anywheresoftware.b4a.objects.IntentWrapper");

@Override
public void resume(BA ba, RemoteObject result) throws Exception{
try {
		Debug.PushSubsStack("B4XPage_Appear (c_updateavailable) ","c_updateavailable",19,__ref.getField(false, "ba"),__ref,18);
Debug.locals = rsLocals;Debug.currentSubFrame.locals = rsLocals;

    while (true) {
try {

        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
Debug.locals.put("_ref", __ref);
 BA.debugLineNum = 19;BA.debugLine="Try";
Debug.ShouldStop(262144);
if (true) break;

case 1:
//try
this.state = 10;
this.catchState = 9;
this.state = 3;
if (true) break;

case 3:
//C
this.state = 4;
this.catchState = 9;
 BA.debugLineNum = 20;BA.debugLine="Do While Not(CanRequestPackageInstalls)";
Debug.ShouldStop(524288);
if (true) break;

case 4:
//do while
this.state = 7;
while (parent.__c.runMethod(true,"Not",(Object)(__ref.runClassMethod (keymon.lat.medicomed.c_updateavailable.class, "_canrequestpackageinstalls" /*RemoteObject*/ ))).<Boolean>get().booleanValue()) {
this.state = 6;
if (true) break;
}
if (true) break;

case 6:
//C
this.state = 4;
 BA.debugLineNum = 21;BA.debugLine="MsgboxAsync($\"Por favor permita que ${Applicati";
Debug.ShouldStop(1048576);
parent.__c.runVoidMethod ("MsgboxAsync",(Object)(BA.ObjectToCharSequence((RemoteObject.concat(RemoteObject.createImmutable("Por favor permita que "),parent.__c.runMethod(true,"SmartStringFormatter",(Object)(BA.ObjectToString("")),(Object)((parent.__c.getField(false,"Application").runMethod(true,"getPackageName")))),RemoteObject.createImmutable(" instale actualizaciones"))))),(Object)(BA.ObjectToCharSequence(RemoteObject.createImmutable("Instalar actualización"))),__ref.getField(false, "ba"));
 BA.debugLineNum = 22;BA.debugLine="Wait For Msgbox_Result(Result As Int)";
Debug.ShouldStop(2097152);
parent.__c.runVoidMethod ("WaitFor","msgbox_result", __ref.getField(false, "ba"), anywheresoftware.b4a.pc.PCResumableSub.createDebugResumeSub(this, "c_updateavailable", "b4xpage_appear"), null);
this.state = 16;
return;
case 16:
//C
this.state = 4;
_result = (RemoteObject) result.getArrayElement(true,RemoteObject.createImmutable(1));Debug.locals.put("Result", _result);
;
 BA.debugLineNum = 23;BA.debugLine="Dim in As Intent";
Debug.ShouldStop(4194304);
_in = RemoteObject.createNew ("anywheresoftware.b4a.objects.IntentWrapper");Debug.locals.put("in", _in);
 BA.debugLineNum = 24;BA.debugLine="in.Initialize(\"android.settings.\", \"package:\" &";
Debug.ShouldStop(8388608);
_in.runVoidMethod ("Initialize",(Object)(BA.ObjectToString("android.settings.")),(Object)(RemoteObject.concat(RemoteObject.createImmutable("package:"),parent.__c.getField(false,"Application").runMethod(true,"getPackageName"))));
 BA.debugLineNum = 25;BA.debugLine="StartActivity(in)";
Debug.ShouldStop(16777216);
parent.__c.runVoidMethod ("StartActivity",__ref.getField(false, "ba"),(Object)((_in.getObject())));
 if (true) break;

case 7:
//C
this.state = 10;
;
 Debug.CheckDeviceExceptions();
if (true) break;

case 9:
//C
this.state = 10;
this.catchState = 0;
 BA.debugLineNum = 28;BA.debugLine="Log(\"updateAvailable() Error - \" & LastException";
Debug.ShouldStop(134217728);
parent.__c.runVoidMethod ("LogImpl","326804234",RemoteObject.concat(RemoteObject.createImmutable("updateAvailable() Error - "),parent.__c.runMethod(false,"LastException",__ref.getField(false, "ba")).runMethod(true,"getMessage")),0);
 if (true) break;
if (true) break;
;
 BA.debugLineNum = 30;BA.debugLine="If appUpdater.newApp.update Then";
Debug.ShouldStop(536870912);

case 10:
//if
this.state = 15;
this.catchState = 0;
if (parent._appupdater._newapp /*RemoteObject*/ .getField(true,"update" /*RemoteObject*/ ).<Boolean>get().booleanValue()) { 
this.state = 12;
}else {
this.state = 14;
}if (true) break;

case 12:
//C
this.state = 15;
 BA.debugLineNum = 31;BA.debugLine="ofreceActualizacion";
Debug.ShouldStop(1073741824);
__ref.runClassMethod (keymon.lat.medicomed.c_updateavailable.class, "_ofreceactualizacion" /*RemoteObject*/ );
 if (true) break;

case 14:
//C
this.state = 15;
 BA.debugLineNum = 33;BA.debugLine="sinActualizacion";
Debug.ShouldStop(1);
__ref.runClassMethod (keymon.lat.medicomed.c_updateavailable.class, "_sinactualizacion" /*RemoteObject*/ );
 if (true) break;

case 15:
//C
this.state = -1;
;
 BA.debugLineNum = 35;BA.debugLine="End Sub";
Debug.ShouldStop(4);
if (true) break;
}} 
       catch (Exception e0) {
			
if (catchState == 0)
    throw e0;
else {
    state = catchState;
BA.rdebugUtils.runVoidMethod("setLastException",__ref.getField(false, "ba"), e0.toString());}
            }
        }
    }
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
}
public static void  _msgbox_result(RemoteObject __ref,RemoteObject _result) throws Exception{
}
public static RemoteObject  _b4xpage_created(RemoteObject __ref,RemoteObject _root1) throws Exception{
try {
		Debug.PushSubsStack("B4XPage_Created (c_updateavailable) ","c_updateavailable",19,__ref.getField(false, "ba"),__ref,12);
if (RapidSub.canDelegate("b4xpage_created")) { return __ref.runUserSub(false, "c_updateavailable","b4xpage_created", __ref, _root1);}
Debug.locals.put("Root1", _root1);
 BA.debugLineNum = 12;BA.debugLine="Private Sub B4XPage_Created (Root1 As B4XView)";
Debug.ShouldStop(2048);
 BA.debugLineNum = 13;BA.debugLine="Root = Root1";
Debug.ShouldStop(4096);
__ref.setField ("_root" /*RemoteObject*/ ,_root1);
 BA.debugLineNum = 15;BA.debugLine="Root.Color = Colors.Transparent";
Debug.ShouldStop(16384);
__ref.getField(false,"_root" /*RemoteObject*/ ).runMethod(true,"setColor",c_updateavailable.__c.getField(false,"Colors").getField(true,"Transparent"));
 BA.debugLineNum = 16;BA.debugLine="End Sub";
Debug.ShouldStop(32768);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _canrequestpackageinstalls(RemoteObject __ref) throws Exception{
try {
		Debug.PushSubsStack("CanRequestPackageInstalls (c_updateavailable) ","c_updateavailable",19,__ref.getField(false, "ba"),__ref,43);
if (RapidSub.canDelegate("canrequestpackageinstalls")) { return __ref.runUserSub(false, "c_updateavailable","canrequestpackageinstalls", __ref);}
RemoteObject _ctxt = RemoteObject.declareNull("anywheresoftware.b4j.object.JavaObject");
RemoteObject _packagemanager = RemoteObject.declareNull("anywheresoftware.b4j.object.JavaObject");
 BA.debugLineNum = 43;BA.debugLine="public Sub CanRequestPackageInstalls As Boolean";
Debug.ShouldStop(1024);
 BA.debugLineNum = 45;BA.debugLine="Dim ctxt As JavaObject";
Debug.ShouldStop(4096);
_ctxt = RemoteObject.createNew ("anywheresoftware.b4j.object.JavaObject");Debug.locals.put("ctxt", _ctxt);
 BA.debugLineNum = 46;BA.debugLine="ctxt.InitializeContext";
Debug.ShouldStop(8192);
_ctxt.runVoidMethod ("InitializeContext",__ref.getField(false, "ba"));
 BA.debugLineNum = 47;BA.debugLine="Dim PackageManager As JavaObject = ctxt.RunMethod";
Debug.ShouldStop(16384);
_packagemanager = RemoteObject.createNew ("anywheresoftware.b4j.object.JavaObject");
_packagemanager = RemoteObject.declareNull("anywheresoftware.b4a.AbsObjectWrapper").runMethod(false, "ConvertToWrapper", RemoteObject.createNew("anywheresoftware.b4j.object.JavaObject"), _ctxt.runMethod(false,"RunMethod",(Object)(BA.ObjectToString("getPackageManager")),(Object)((c_updateavailable.__c.getField(false,"Null")))));Debug.locals.put("PackageManager", _packagemanager);Debug.locals.put("PackageManager", _packagemanager);
 BA.debugLineNum = 48;BA.debugLine="Return PackageManager.RunMethod(\"canRequestPackag";
Debug.ShouldStop(32768);
if (true) return BA.ObjectToBoolean(_packagemanager.runMethod(false,"RunMethod",(Object)(BA.ObjectToString("canRequestPackageInstalls")),(Object)((c_updateavailable.__c.getField(false,"Null")))));
 BA.debugLineNum = 49;BA.debugLine="End Sub";
Debug.ShouldStop(65536);
return RemoteObject.createImmutable(false);
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _class_globals(RemoteObject __ref) throws Exception{
 //BA.debugLineNum = 1;BA.debugLine="Sub Class_Globals";
 //BA.debugLineNum = 2;BA.debugLine="Private Root As B4XView 'ignore";
c_updateavailable._root = RemoteObject.createNew ("anywheresoftware.b4a.objects.B4XViewWrapper");__ref.setField("_root",c_updateavailable._root);
 //BA.debugLineNum = 3;BA.debugLine="Private xui As XUI 'ignore";
c_updateavailable._xui = RemoteObject.createNew ("anywheresoftware.b4a.objects.B4XViewWrapper.XUI");__ref.setField("_xui",c_updateavailable._xui);
 //BA.debugLineNum = 4;BA.debugLine="End Sub";
return RemoteObject.createImmutable("");
}
public static RemoteObject  _initialize(RemoteObject __ref,RemoteObject _ba) throws Exception{
try {
		Debug.PushSubsStack("Initialize (c_updateavailable) ","c_updateavailable",19,__ref.getField(false, "ba"),__ref,7);
if (RapidSub.canDelegate("initialize")) { return __ref.runUserSub(false, "c_updateavailable","initialize", __ref, _ba);}
__ref.runVoidMethodAndSync("innerInitializeHelper", _ba);
Debug.locals.put("ba", _ba);
 BA.debugLineNum = 7;BA.debugLine="Public Sub Initialize As Object";
Debug.ShouldStop(64);
 BA.debugLineNum = 8;BA.debugLine="Return Me";
Debug.ShouldStop(128);
if (true) return __ref;
 BA.debugLineNum = 9;BA.debugLine="End Sub";
Debug.ShouldStop(256);
return RemoteObject.createImmutable(null);
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _ofreceactualizacion(RemoteObject __ref) throws Exception{
try {
		Debug.PushSubsStack("ofreceActualizacion (c_updateavailable) ","c_updateavailable",19,__ref.getField(false, "ba"),__ref,51);
if (RapidSub.canDelegate("ofreceactualizacion")) { return __ref.runUserSub(false, "c_updateavailable","ofreceactualizacion", __ref);}
 BA.debugLineNum = 51;BA.debugLine="Sub ofreceActualizacion";
Debug.ShouldStop(262144);
 BA.debugLineNum = 52;BA.debugLine="If Msgbox2(appUpdater.newApp.newMsg,\"Actualizació";
Debug.ShouldStop(524288);
if (RemoteObject.solveBoolean("=",c_updateavailable.__c.runMethodAndSync(true,"Msgbox2",(Object)(BA.ObjectToCharSequence(c_updateavailable._appupdater._newapp /*RemoteObject*/ .getField(true,"newMsg" /*RemoteObject*/ ))),(Object)(BA.ObjectToCharSequence("Actualización disponible")),(Object)(BA.ObjectToString("Si")),(Object)(BA.ObjectToString("")),(Object)(BA.ObjectToString("No")),(Object)((c_updateavailable.__c.getField(false,"Null"))),__ref.getField(false, "ba")),BA.numberCast(double.class, c_updateavailable.__c.getField(false,"DialogResponse").getField(true,"POSITIVE")))) { 
 BA.debugLineNum = 54;BA.debugLine="CallSubDelayed(appUpdater, \"download_newApk\")";
Debug.ShouldStop(2097152);
c_updateavailable.__c.runVoidMethod ("CallSubDelayed",__ref.getField(false, "ba"),(Object)((c_updateavailable._appupdater.getObject())),(Object)(RemoteObject.createImmutable("download_newApk")));
 };
 BA.debugLineNum = 57;BA.debugLine="B4XPages.MainPage.ocultaProgreso";
Debug.ShouldStop(16777216);
c_updateavailable._b4xpages.runMethod(false,"_mainpage" /*RemoteObject*/ ,__ref.getField(false, "ba")).runClassMethod (keymon.lat.medicomed.b4xmainpage.class, "_ocultaprogreso" /*RemoteObject*/ );
 BA.debugLineNum = 58;BA.debugLine="StartActivity(Main)";
Debug.ShouldStop(33554432);
c_updateavailable.__c.runVoidMethod ("StartActivity",__ref.getField(false, "ba"),(Object)((c_updateavailable._main.getObject())));
 BA.debugLineNum = 60;BA.debugLine="B4XPages.ShowPage(\"Login\")";
Debug.ShouldStop(134217728);
c_updateavailable._b4xpages.runVoidMethod ("_showpage" /*RemoteObject*/ ,__ref.getField(false, "ba"),(Object)(RemoteObject.createImmutable("Login")));
 BA.debugLineNum = 61;BA.debugLine="End Sub";
Debug.ShouldStop(268435456);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _sinactualizacion(RemoteObject __ref) throws Exception{
try {
		Debug.PushSubsStack("sinActualizacion (c_updateavailable) ","c_updateavailable",19,__ref.getField(false, "ba"),__ref,63);
if (RapidSub.canDelegate("sinactualizacion")) { return __ref.runUserSub(false, "c_updateavailable","sinactualizacion", __ref);}
 BA.debugLineNum = 63;BA.debugLine="Sub sinActualizacion";
Debug.ShouldStop(1073741824);
 BA.debugLineNum = 64;BA.debugLine="Msgbox(appUpdater.newApp.okMsg, \"Aplicación al co";
Debug.ShouldStop(-2147483648);
c_updateavailable.__c.runVoidMethodAndSync ("Msgbox",(Object)(BA.ObjectToCharSequence(c_updateavailable._appupdater._newapp /*RemoteObject*/ .getField(true,"okMsg" /*RemoteObject*/ ))),(Object)(BA.ObjectToCharSequence(RemoteObject.createImmutable("Aplicación al corriente"))),__ref.getField(false, "ba"));
 BA.debugLineNum = 66;BA.debugLine="B4XPages.MainPage.ocultaProgreso";
Debug.ShouldStop(2);
c_updateavailable._b4xpages.runMethod(false,"_mainpage" /*RemoteObject*/ ,__ref.getField(false, "ba")).runClassMethod (keymon.lat.medicomed.b4xmainpage.class, "_ocultaprogreso" /*RemoteObject*/ );
 BA.debugLineNum = 67;BA.debugLine="B4XPages.ShowPage(\"Login\")";
Debug.ShouldStop(4);
c_updateavailable._b4xpages.runVoidMethod ("_showpage" /*RemoteObject*/ ,__ref.getField(false, "ba"),(Object)(RemoteObject.createImmutable("Login")));
 BA.debugLineNum = 68;BA.debugLine="End Sub";
Debug.ShouldStop(8);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			throw Debug.ErrorCaught(e);
		} 
finally {
			Debug.PopSubsStack();
		}}
}