package shub.dpm;


import anywheresoftware.b4a.B4AMenuItem;
import android.app.Activity;
import android.os.Bundle;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.B4AActivity;
import anywheresoftware.b4a.ObjectWrapper;
import anywheresoftware.b4a.objects.ActivityWrapper;
import java.lang.reflect.InvocationTargetException;
import anywheresoftware.b4a.B4AUncaughtException;
import anywheresoftware.b4a.debug.*;
import java.lang.ref.WeakReference;

public class barcodescanner extends Activity implements B4AActivity{
	public static barcodescanner mostCurrent;
	static boolean afterFirstLayout;
	static boolean isFirst = true;
    private static boolean processGlobalsRun = false;
	BALayout layout;
	public static BA processBA;
	BA activityBA;
    ActivityWrapper _activity;
    java.util.ArrayList<B4AMenuItem> menuItems;
	public static final boolean fullScreen = false;
	public static final boolean includeTitle = true;
    public static WeakReference<Activity> previousOne;
    public static boolean dontPause;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
        mostCurrent = this;
		if (processBA == null) {
			processBA = new anywheresoftware.b4a.ShellBA(this.getApplicationContext(), null, null, "shub.dpm", "shub.dpm.barcodescanner");
			processBA.loadHtSubs(this.getClass());
	        float deviceScale = getApplicationContext().getResources().getDisplayMetrics().density;
	        BALayout.setDeviceScale(deviceScale);
            
		}
		else if (previousOne != null) {
			Activity p = previousOne.get();
			if (p != null && p != this) {
                BA.LogInfo("Killing previous instance (barcodescanner).");
				p.finish();
			}
		}
        processBA.setActivityPaused(true);
        processBA.runHook("oncreate", this, null);
		if (!includeTitle) {
        	this.getWindow().requestFeature(android.view.Window.FEATURE_NO_TITLE);
        }
        if (fullScreen) {
        	getWindow().setFlags(android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN,   
        			android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
		
        processBA.sharedProcessBA.activityBA = null;
		layout = new BALayout(this);
		setContentView(layout);
		afterFirstLayout = false;
        WaitForLayout wl = new WaitForLayout();
        if (anywheresoftware.b4a.objects.ServiceHelper.StarterHelper.startFromActivity(this, processBA, wl, false))
		    BA.handler.postDelayed(wl, 5);

	}
	static class WaitForLayout implements Runnable {
		public void run() {
			if (afterFirstLayout)
				return;
			if (mostCurrent == null)
				return;
            
			if (mostCurrent.layout.getWidth() == 0) {
				BA.handler.postDelayed(this, 5);
				return;
			}
			mostCurrent.layout.getLayoutParams().height = mostCurrent.layout.getHeight();
			mostCurrent.layout.getLayoutParams().width = mostCurrent.layout.getWidth();
			afterFirstLayout = true;
			mostCurrent.afterFirstLayout();
		}
	}
	private void afterFirstLayout() {
        if (this != mostCurrent)
			return;
		activityBA = new BA(this, layout, processBA, "shub.dpm", "shub.dpm.barcodescanner");
        
        processBA.sharedProcessBA.activityBA = new java.lang.ref.WeakReference<BA>(activityBA);
        anywheresoftware.b4a.objects.ViewWrapper.lastId = 0;
        _activity = new ActivityWrapper(activityBA, "activity");
        anywheresoftware.b4a.Msgbox.isDismissing = false;
        if (BA.isShellModeRuntimeCheck(processBA)) {
			if (isFirst)
				processBA.raiseEvent2(null, true, "SHELL", false);
			processBA.raiseEvent2(null, true, "CREATE", true, "shub.dpm.barcodescanner", processBA, activityBA, _activity, anywheresoftware.b4a.keywords.Common.Density, mostCurrent);
			_activity.reinitializeForShell(activityBA, "activity");
		}
        initializeProcessGlobals();		
        initializeGlobals();
        
        BA.LogInfo("** Activity (barcodescanner) Create, isFirst = " + isFirst + " **");
        processBA.raiseEvent2(null, true, "activity_create", false, isFirst);
		isFirst = false;
		if (this != mostCurrent)
			return;
        processBA.setActivityPaused(false);
        BA.LogInfo("** Activity (barcodescanner) Resume **");
        processBA.raiseEvent(null, "activity_resume");
        if (android.os.Build.VERSION.SDK_INT >= 11) {
			try {
				android.app.Activity.class.getMethod("invalidateOptionsMenu").invoke(this,(Object[]) null);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

	}
	public void addMenuItem(B4AMenuItem item) {
		if (menuItems == null)
			menuItems = new java.util.ArrayList<B4AMenuItem>();
		menuItems.add(item);
	}
	@Override
	public boolean onCreateOptionsMenu(android.view.Menu menu) {
		super.onCreateOptionsMenu(menu);
        try {
            if (processBA.subExists("activity_actionbarhomeclick")) {
                Class.forName("android.app.ActionBar").getMethod("setHomeButtonEnabled", boolean.class).invoke(
                    getClass().getMethod("getActionBar").invoke(this), true);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (processBA.runHook("oncreateoptionsmenu", this, new Object[] {menu}))
            return true;
		if (menuItems == null)
			return false;
		for (B4AMenuItem bmi : menuItems) {
			android.view.MenuItem mi = menu.add(bmi.title);
			if (bmi.drawable != null)
				mi.setIcon(bmi.drawable);
            if (android.os.Build.VERSION.SDK_INT >= 11) {
				try {
                    if (bmi.addToBar) {
				        android.view.MenuItem.class.getMethod("setShowAsAction", int.class).invoke(mi, 1);
                    }
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			mi.setOnMenuItemClickListener(new B4AMenuItemsClickListener(bmi.eventName.toLowerCase(BA.cul)));
		}
        
		return true;
	}   
 @Override
 public boolean onOptionsItemSelected(android.view.MenuItem item) {
    if (item.getItemId() == 16908332) {
        processBA.raiseEvent(null, "activity_actionbarhomeclick");
        return true;
    }
    else
        return super.onOptionsItemSelected(item); 
}
@Override
 public boolean onPrepareOptionsMenu(android.view.Menu menu) {
    super.onPrepareOptionsMenu(menu);
    processBA.runHook("onprepareoptionsmenu", this, new Object[] {menu});
    return true;
    
 }
 protected void onStart() {
    super.onStart();
    processBA.runHook("onstart", this, null);
}
 protected void onStop() {
    super.onStop();
    processBA.runHook("onstop", this, null);
}
    public void onWindowFocusChanged(boolean hasFocus) {
       super.onWindowFocusChanged(hasFocus);
       if (processBA.subExists("activity_windowfocuschanged"))
           processBA.raiseEvent2(null, true, "activity_windowfocuschanged", false, hasFocus);
    }
	private class B4AMenuItemsClickListener implements android.view.MenuItem.OnMenuItemClickListener {
		private final String eventName;
		public B4AMenuItemsClickListener(String eventName) {
			this.eventName = eventName;
		}
		public boolean onMenuItemClick(android.view.MenuItem item) {
			processBA.raiseEventFromUI(item.getTitle(), eventName + "_click");
			return true;
		}
	}
    public static Class<?> getObject() {
		return barcodescanner.class;
	}
    private Boolean onKeySubExist = null;
    private Boolean onKeyUpSubExist = null;
	@Override
	public boolean onKeyDown(int keyCode, android.view.KeyEvent event) {
        if (processBA.runHook("onkeydown", this, new Object[] {keyCode, event}))
            return true;
		if (onKeySubExist == null)
			onKeySubExist = processBA.subExists("activity_keypress");
		if (onKeySubExist) {
			if (keyCode == anywheresoftware.b4a.keywords.constants.KeyCodes.KEYCODE_BACK &&
					android.os.Build.VERSION.SDK_INT >= 18) {
				HandleKeyDelayed hk = new HandleKeyDelayed();
				hk.kc = keyCode;
				BA.handler.post(hk);
				return true;
			}
			else {
				boolean res = new HandleKeyDelayed().runDirectly(keyCode);
				if (res)
					return true;
			}
		}
		return super.onKeyDown(keyCode, event);
	}
	private class HandleKeyDelayed implements Runnable {
		int kc;
		public void run() {
			runDirectly(kc);
		}
		public boolean runDirectly(int keyCode) {
			Boolean res =  (Boolean)processBA.raiseEvent2(_activity, false, "activity_keypress", false, keyCode);
			if (res == null || res == true) {
                return true;
            }
            else if (keyCode == anywheresoftware.b4a.keywords.constants.KeyCodes.KEYCODE_BACK) {
				finish();
				return true;
			}
            return false;
		}
		
	}
    @Override
	public boolean onKeyUp(int keyCode, android.view.KeyEvent event) {
        if (processBA.runHook("onkeyup", this, new Object[] {keyCode, event}))
            return true;
		if (onKeyUpSubExist == null)
			onKeyUpSubExist = processBA.subExists("activity_keyup");
		if (onKeyUpSubExist) {
			Boolean res =  (Boolean)processBA.raiseEvent2(_activity, false, "activity_keyup", false, keyCode);
			if (res == null || res == true)
				return true;
		}
		return super.onKeyUp(keyCode, event);
	}
	@Override
	public void onNewIntent(android.content.Intent intent) {
        super.onNewIntent(intent);
		this.setIntent(intent);
        processBA.runHook("onnewintent", this, new Object[] {intent});
	}
    @Override 
	public void onPause() {
		super.onPause();
        if (_activity == null)
            return;
        if (this != mostCurrent)
			return;
		anywheresoftware.b4a.Msgbox.dismiss(true);
        if (!dontPause)
            BA.LogInfo("** Activity (barcodescanner) Pause, UserClosed = " + activityBA.activity.isFinishing() + " **");
        else
            BA.LogInfo("** Activity (barcodescanner) Pause event (activity is not paused). **");
        if (mostCurrent != null)
            processBA.raiseEvent2(_activity, true, "activity_pause", false, activityBA.activity.isFinishing());		
        if (!dontPause) {
            processBA.setActivityPaused(true);
            mostCurrent = null;
        }

        if (!activityBA.activity.isFinishing())
			previousOne = new WeakReference<Activity>(this);
        anywheresoftware.b4a.Msgbox.isDismissing = false;
        processBA.runHook("onpause", this, null);
	}

	@Override
	public void onDestroy() {
        super.onDestroy();
		previousOne = null;
        processBA.runHook("ondestroy", this, null);
	}
    @Override 
	public void onResume() {
		super.onResume();
        mostCurrent = this;
        anywheresoftware.b4a.Msgbox.isDismissing = false;
        if (activityBA != null) { //will be null during activity create (which waits for AfterLayout).
        	ResumeMessage rm = new ResumeMessage(mostCurrent);
        	BA.handler.post(rm);
        }
        processBA.runHook("onresume", this, null);
	}
    private static class ResumeMessage implements Runnable {
    	private final WeakReference<Activity> activity;
    	public ResumeMessage(Activity activity) {
    		this.activity = new WeakReference<Activity>(activity);
    	}
		public void run() {
            barcodescanner mc = mostCurrent;
			if (mc == null || mc != activity.get())
				return;
			processBA.setActivityPaused(false);
            BA.LogInfo("** Activity (barcodescanner) Resume **");
            if (mc != mostCurrent)
                return;
		    processBA.raiseEvent(mc._activity, "activity_resume", (Object[])null);
		}
    }
	@Override
	protected void onActivityResult(int requestCode, int resultCode,
	      android.content.Intent data) {
		processBA.onActivityResult(requestCode, resultCode, data);
        processBA.runHook("onactivityresult", this, new Object[] {requestCode, resultCode});
	}
	private static void initializeGlobals() {
		processBA.raiseEvent2(null, true, "globals", false, (Object[])null);
	}
    public void onRequestPermissionsResult(int requestCode,
        String permissions[], int[] grantResults) {
        for (int i = 0;i < permissions.length;i++) {
            Object[] o = new Object[] {permissions[i], grantResults[i] == 0};
            processBA.raiseEventFromDifferentThread(null,null, 0, "activity_permissionresult", true, o);
        }
            
    }



public static void initializeProcessGlobals() {
             try {
                Class.forName(BA.applicationContext.getPackageName() + ".main").getMethod("initializeProcessGlobals").invoke(null, null);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
}
public anywheresoftware.b4a.keywords.Common __c = null;
public billwrapper.billWrapper _bs1 = null;
public anywheresoftware.b4a.objects.Timer _pattimer = null;
public anywheresoftware.b4a.objects.LabelWrapper _lblpatient = null;
public anywheresoftware.b4a.objects.PanelWrapper _pnlenterpatid = null;
public anywheresoftware.b4a.objects.EditTextWrapper _txtpatnr = null;
public shub.dpm.main _main = null;
public shub.dpm.parameter _parameter = null;
public shub.dpm.about _about = null;
public shub.dpm.allgfnkt _allgfnkt = null;
public shub.dpm.listpat _listpat = null;
public shub.dpm.endecodetester _endecodetester = null;
public shub.dpm.jobservice _jobservice = null;
public shub.dpm.listdata _listdata = null;
public shub.dpm.starter _starter = null;
public shub.dpm.b4xpages _b4xpages = null;
public shub.dpm.b4xcollections _b4xcollections = null;
public shub.dpm.httputils2service _httputils2service = null;
public static String  _activity_create(boolean _firsttime) throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "activity_create", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "activity_create", new Object[] {_firsttime}));}
RDebugUtils.currentLine=1966080;
 //BA.debugLineNum = 1966080;BA.debugLine="Sub Activity_Create(FirstTime As Boolean)";
RDebugUtils.currentLine=1966082;
 //BA.debugLineNum = 1966082;BA.debugLine="Activity.LoadLayout(\"BarcodeScanner\")";
mostCurrent._activity.LoadLayout("BarcodeScanner",mostCurrent.activityBA);
RDebugUtils.currentLine=1966083;
 //BA.debugLineNum = 1966083;BA.debugLine="Activity.Title=\"Charge-Scanner\"";
mostCurrent._activity.setTitle(BA.ObjectToCharSequence("Charge-Scanner"));
RDebugUtils.currentLine=1966086;
 //BA.debugLineNum = 1966086;BA.debugLine="bs1.ScanMode = bs1.FORMAT_ONE_D";
mostCurrent._bs1.setScanMode(mostCurrent._bs1.FORMAT_ONE_D);
RDebugUtils.currentLine=1966087;
 //BA.debugLineNum = 1966087;BA.debugLine="AllgFnkt.PatID=0";
mostCurrent._allgfnkt._patid /*String*/  = BA.NumberToString(0);
RDebugUtils.currentLine=1966088;
 //BA.debugLineNum = 1966088;BA.debugLine="If File.Exists(File.DirInternal ,\"DPM.ini\") = Tru";
if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"DPM.ini")==anywheresoftware.b4a.keywords.Common.True) { 
RDebugUtils.currentLine=1966089;
 //BA.debugLineNum = 1966089;BA.debugLine="AllgFnkt.sURL=AllgFnkt.Get_Params(\"URL\")";
mostCurrent._allgfnkt._surl /*String*/  = mostCurrent._allgfnkt._get_params /*String*/ (mostCurrent.activityBA,"URL");
RDebugUtils.currentLine=1966090;
 //BA.debugLineNum = 1966090;BA.debugLine="AllgFnkt.ResettimerInterval=AllgFnkt.Get_Params(";
mostCurrent._allgfnkt._resettimerinterval /*int*/  = (int)(Double.parseDouble(mostCurrent._allgfnkt._get_params /*String*/ (mostCurrent.activityBA,"TIMER")));
 }else {
 };
RDebugUtils.currentLine=1966093;
 //BA.debugLineNum = 1966093;BA.debugLine="lblpatient.Text=\"Bitte Patient auswählen\"";
mostCurrent._lblpatient.setText(BA.ObjectToCharSequence("Bitte Patient auswählen"));
RDebugUtils.currentLine=1966094;
 //BA.debugLineNum = 1966094;BA.debugLine="pattimer.Initialize(\"timer\",AllgFnkt.ResettimerIn";
mostCurrent._pattimer.Initialize(processBA,"timer",(long) (mostCurrent._allgfnkt._resettimerinterval /*int*/ ));
RDebugUtils.currentLine=1966095;
 //BA.debugLineNum = 1966095;BA.debugLine="End Sub";
return "";
}
public static String  _activity_pause(boolean _userclosed) throws Exception{
RDebugUtils.currentModule="barcodescanner";
RDebugUtils.currentLine=2097152;
 //BA.debugLineNum = 2097152;BA.debugLine="Sub Activity_Pause (UserClosed As Boolean)";
RDebugUtils.currentLine=2097153;
 //BA.debugLineNum = 2097153;BA.debugLine="Try";
try {RDebugUtils.currentLine=2097154;
 //BA.debugLineNum = 2097154;BA.debugLine="bs1.stopScanning";
mostCurrent._bs1.stopScanning();
 } 
       catch (Exception e4) {
			processBA.setLastException(e4); };
RDebugUtils.currentLine=2097158;
 //BA.debugLineNum = 2097158;BA.debugLine="End Sub";
return "";
}
public static String  _activity_resume() throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "activity_resume", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "activity_resume", null));}
RDebugUtils.currentLine=2031616;
 //BA.debugLineNum = 2031616;BA.debugLine="Sub Activity_Resume";
RDebugUtils.currentLine=2031618;
 //BA.debugLineNum = 2031618;BA.debugLine="If AllgFnkt.pid<>\"\" Then AllgFnkt.PatID=AllgFnkt.";
if ((mostCurrent._allgfnkt._pid /*String*/ ).equals("") == false) { 
mostCurrent._allgfnkt._patid /*String*/  = mostCurrent._allgfnkt._pid /*String*/ ;};
RDebugUtils.currentLine=2031620;
 //BA.debugLineNum = 2031620;BA.debugLine="If File.Exists(File.DirInternal ,\"DPM.ini\") = Tru";
if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"DPM.ini")==anywheresoftware.b4a.keywords.Common.True) { 
RDebugUtils.currentLine=2031621;
 //BA.debugLineNum = 2031621;BA.debugLine="AllgFnkt.Get_Params(\"TIMER\")";
mostCurrent._allgfnkt._get_params /*String*/ (mostCurrent.activityBA,"TIMER");
RDebugUtils.currentLine=2031622;
 //BA.debugLineNum = 2031622;BA.debugLine="pattimer.Enabled=False";
mostCurrent._pattimer.setEnabled(anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=2031623;
 //BA.debugLineNum = 2031623;BA.debugLine="pattimer.Initialize(\"timer\",AllgFnkt.ResettimerI";
mostCurrent._pattimer.Initialize(processBA,"timer",(long) (mostCurrent._allgfnkt._resettimerinterval /*int*/ ));
RDebugUtils.currentLine=2031624;
 //BA.debugLineNum = 2031624;BA.debugLine="pattimer.Enabled=True";
mostCurrent._pattimer.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 };
RDebugUtils.currentLine=2031626;
 //BA.debugLineNum = 2031626;BA.debugLine="If AllgFnkt.PID<>\"\" Then get_Pat(AllgFnkt.PID)";
if ((mostCurrent._allgfnkt._pid /*String*/ ).equals("") == false) { 
_get_pat(mostCurrent._allgfnkt._pid /*String*/ );};
RDebugUtils.currentLine=2031627;
 //BA.debugLineNum = 2031627;BA.debugLine="End Sub";
return "";
}
public static void  _get_pat(String _id) throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "get_pat", false))
	 {Debug.delegate(mostCurrent.activityBA, "get_pat", new Object[] {_id}); return;}
ResumableSub_get_Pat rsub = new ResumableSub_get_Pat(null,_id);
rsub.resume(processBA, null);
}
public static class ResumableSub_get_Pat extends BA.ResumableSub {
public ResumableSub_get_Pat(shub.dpm.barcodescanner parent,String _id) {
this.parent = parent;
this._id = _id;
}
shub.dpm.barcodescanner parent;
String _id;
shub.dpm.httpjob _job = null;
String _callurl = "";
String _res = "";
anywheresoftware.b4a.objects.collections.JSONParser _parser = null;
anywheresoftware.b4a.objects.collections.List _list1 = null;
anywheresoftware.b4a.objects.collections.Map _map1 = null;

@Override
public void resume(BA ba, Object[] result) throws Exception{
RDebugUtils.currentModule="barcodescanner";

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
RDebugUtils.currentLine=2228226;
 //BA.debugLineNum = 2228226;BA.debugLine="Dim job As HttpJob";
_job = new shub.dpm.httpjob();
RDebugUtils.currentLine=2228227;
 //BA.debugLineNum = 2228227;BA.debugLine="AllgFnkt.JobName=\"GetPat\"";
parent.mostCurrent._allgfnkt._jobname /*String*/  = "GetPat";
RDebugUtils.currentLine=2228228;
 //BA.debugLineNum = 2228228;BA.debugLine="job.Initialize(AllgFnkt.JobName, Me)";
_job._initialize /*String*/ (null,processBA,parent.mostCurrent._allgfnkt._jobname /*String*/ ,barcodescanner.getObject());
RDebugUtils.currentLine=2228229;
 //BA.debugLineNum = 2228229;BA.debugLine="Dim callurl As String = AllgFnkt.GetURL(id,\"\")";
_callurl = parent.mostCurrent._allgfnkt._geturl /*String*/ (mostCurrent.activityBA,_id,"");
RDebugUtils.currentLine=2228230;
 //BA.debugLineNum = 2228230;BA.debugLine="job.Download(callurl)";
_job._download /*String*/ (null,_callurl);
RDebugUtils.currentLine=2228231;
 //BA.debugLineNum = 2228231;BA.debugLine="job.GetRequest.SetHeader(\"ApiKey\",AllgFnkt.apikey";
_job._getrequest /*anywheresoftware.b4h.okhttp.OkHttpClientWrapper.OkHttpRequest*/ (null).SetHeader("ApiKey",parent.mostCurrent._allgfnkt._apikey /*String*/ );
RDebugUtils.currentLine=2228232;
 //BA.debugLineNum = 2228232;BA.debugLine="Wait For (job) JobDone(job As HttpJob)";
anywheresoftware.b4a.keywords.Common.WaitFor("jobdone", processBA, new anywheresoftware.b4a.shell.DebugResumableSub.DelegatableResumableSub(this, "barcodescanner", "get_pat"), (Object)(_job));
this.state = 11;
return;
case 11:
//C
this.state = 1;
_job = (shub.dpm.httpjob) result[0];
;
RDebugUtils.currentLine=2228233;
 //BA.debugLineNum = 2228233;BA.debugLine="If job.Success Then";
if (true) break;

case 1:
//if
this.state = 10;
if (_job._success /*boolean*/ ) { 
this.state = 3;
}else {
this.state = 9;
}if (true) break;

case 3:
//C
this.state = 4;
RDebugUtils.currentLine=2228234;
 //BA.debugLineNum = 2228234;BA.debugLine="Dim res As String";
_res = "";
RDebugUtils.currentLine=2228235;
 //BA.debugLineNum = 2228235;BA.debugLine="res = job.GetString";
_res = _job._getstring /*String*/ (null);
RDebugUtils.currentLine=2228236;
 //BA.debugLineNum = 2228236;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
RDebugUtils.currentLine=2228237;
 //BA.debugLineNum = 2228237;BA.debugLine="parser.Initialize(res)";
_parser.Initialize(_res);
RDebugUtils.currentLine=2228238;
 //BA.debugLineNum = 2228238;BA.debugLine="Dim list1 As List";
_list1 = new anywheresoftware.b4a.objects.collections.List();
RDebugUtils.currentLine=2228239;
 //BA.debugLineNum = 2228239;BA.debugLine="list1 = parser.NextArray";
_list1 = _parser.NextArray();
RDebugUtils.currentLine=2228240;
 //BA.debugLineNum = 2228240;BA.debugLine="If list1.Size<1 Then";
if (true) break;

case 4:
//if
this.state = 7;
if (_list1.getSize()<1) { 
this.state = 6;
}if (true) break;

case 6:
//C
this.state = 7;
RDebugUtils.currentLine=2228241;
 //BA.debugLineNum = 2228241;BA.debugLine="ToastMessageShow(\"Patient nicht vorhanden.\",Tru";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Patient nicht vorhanden."),anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=2228243;
 //BA.debugLineNum = 2228243;BA.debugLine="AllgFnkt.PatID=0";
parent.mostCurrent._allgfnkt._patid /*String*/  = BA.NumberToString(0);
RDebugUtils.currentLine=2228244;
 //BA.debugLineNum = 2228244;BA.debugLine="lblpatient.Text=\"Patient nicht vorhanden.\"";
parent.mostCurrent._lblpatient.setText(BA.ObjectToCharSequence("Patient nicht vorhanden."));
RDebugUtils.currentLine=2228245;
 //BA.debugLineNum = 2228245;BA.debugLine="Return";
if (true) return ;
 if (true) break;

case 7:
//C
this.state = 10;
;
RDebugUtils.currentLine=2228247;
 //BA.debugLineNum = 2228247;BA.debugLine="Dim map1 As Map";
_map1 = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=2228248;
 //BA.debugLineNum = 2228248;BA.debugLine="map1 = list1.Get(0)";
_map1 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (anywheresoftware.b4a.objects.collections.Map.MyMap)(_list1.Get((int) (0))));
RDebugUtils.currentLine=2228250;
 //BA.debugLineNum = 2228250;BA.debugLine="AllgFnkt.PatID = map1.Get(\"id\")";
parent.mostCurrent._allgfnkt._patid /*String*/  = BA.ObjectToString(_map1.Get((Object)("id")));
RDebugUtils.currentLine=2228251;
 //BA.debugLineNum = 2228251;BA.debugLine="AllgFnkt.PatName=map1.Get(\"pat\")";
parent.mostCurrent._allgfnkt._patname /*String*/  = BA.ObjectToString(_map1.Get((Object)("pat")));
RDebugUtils.currentLine=2228252;
 //BA.debugLineNum = 2228252;BA.debugLine="lblpatient.Text=AllgFnkt.PatName";
parent.mostCurrent._lblpatient.setText(BA.ObjectToCharSequence(parent.mostCurrent._allgfnkt._patname /*String*/ ));
 if (true) break;

case 9:
//C
this.state = 10;
RDebugUtils.currentLine=2228255;
 //BA.debugLineNum = 2228255;BA.debugLine="ToastMessageShow(\"Funktionsaufruf fehlgeschlagen";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Funktionsaufruf fehlgeschlagen."),anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=2228256;
 //BA.debugLineNum = 2228256;BA.debugLine="Log(job.ErrorMessage)";
anywheresoftware.b4a.keywords.Common.LogImpl("12228256",_job._errormessage /*String*/ ,0);
 if (true) break;

case 10:
//C
this.state = -1;
;
RDebugUtils.currentLine=2228259;
 //BA.debugLineNum = 2228259;BA.debugLine="job.Release";
_job._release /*String*/ (null);
RDebugUtils.currentLine=2228261;
 //BA.debugLineNum = 2228261;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public static String  _bs1_scan_value(String _val,byte[] _rawbyte,int _barcodetype) throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "bs1_scan_value", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "bs1_scan_value", new Object[] {_val,_rawbyte,_barcodetype}));}
shub.dpm.httpjob _job = null;
anywheresoftware.b4a.audio.Beeper _b = null;
RDebugUtils.currentLine=2359296;
 //BA.debugLineNum = 2359296;BA.debugLine="Sub bs1_scan_value(val As String, rawbyte() As Byt";
RDebugUtils.currentLine=2359297;
 //BA.debugLineNum = 2359297;BA.debugLine="If AllgFnkt.JobEnabled=False Then Return";
if (mostCurrent._allgfnkt._jobenabled /*boolean*/ ==anywheresoftware.b4a.keywords.Common.False) { 
if (true) return "";};
RDebugUtils.currentLine=2359298;
 //BA.debugLineNum = 2359298;BA.debugLine="AllgFnkt.JobEnabled=False";
mostCurrent._allgfnkt._jobenabled /*boolean*/  = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=2359299;
 //BA.debugLineNum = 2359299;BA.debugLine="Try";
try {RDebugUtils.currentLine=2359300;
 //BA.debugLineNum = 2359300;BA.debugLine="bs1.stopScanning";
mostCurrent._bs1.stopScanning();
 } 
       catch (Exception e6) {
			processBA.setLastException(e6); };
RDebugUtils.currentLine=2359304;
 //BA.debugLineNum = 2359304;BA.debugLine="Dim job As HttpJob";
_job = new shub.dpm.httpjob();
RDebugUtils.currentLine=2359305;
 //BA.debugLineNum = 2359305;BA.debugLine="AllgFnkt.JobName=\"PostCharche\"";
mostCurrent._allgfnkt._jobname /*String*/  = "PostCharche";
RDebugUtils.currentLine=2359306;
 //BA.debugLineNum = 2359306;BA.debugLine="job.Initialize(AllgFnkt.JobName, Me)";
_job._initialize /*String*/ (null,processBA,mostCurrent._allgfnkt._jobname /*String*/ ,barcodescanner.getObject());
RDebugUtils.currentLine=2359308;
 //BA.debugLineNum = 2359308;BA.debugLine="job.PostString(AllgFnkt.sURL&\"/DPMService/api/Pat";
_job._poststring /*String*/ (null,mostCurrent._allgfnkt._surl /*String*/ +"/DPMService/api/PatCharge/"+mostCurrent._allgfnkt._patid /*String*/ +"/"+_val,"");
RDebugUtils.currentLine=2359310;
 //BA.debugLineNum = 2359310;BA.debugLine="Dim b As Beeper";
_b = new anywheresoftware.b4a.audio.Beeper();
RDebugUtils.currentLine=2359311;
 //BA.debugLineNum = 2359311;BA.debugLine="b.Initialize(300, 500) '300 milliseconds, 500 hz";
_b.Initialize((int) (300),(int) (500));
RDebugUtils.currentLine=2359312;
 //BA.debugLineNum = 2359312;BA.debugLine="b.Beep";
_b.Beep();
RDebugUtils.currentLine=2359313;
 //BA.debugLineNum = 2359313;BA.debugLine="pattimer.Enabled=True";
mostCurrent._pattimer.setEnabled(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=2359314;
 //BA.debugLineNum = 2359314;BA.debugLine="End Sub";
return "";
}
public static String  _btnenterpatid_click() throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "btnenterpatid_click", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "btnenterpatid_click", null));}
anywheresoftware.b4a.agraham.dialogs.InputDialog _inppat = null;
RDebugUtils.currentLine=2490368;
 //BA.debugLineNum = 2490368;BA.debugLine="Private Sub btnEnterPatID_Click";
RDebugUtils.currentLine=2490369;
 //BA.debugLineNum = 2490369;BA.debugLine="Dim inppat As InputDialog";
_inppat = new anywheresoftware.b4a.agraham.dialogs.InputDialog();
RDebugUtils.currentLine=2490370;
 //BA.debugLineNum = 2490370;BA.debugLine="inppat.InputType=inppat.INPUT_TYPE_NUMBERS";
_inppat.setInputType(_inppat.INPUT_TYPE_NUMBERS);
RDebugUtils.currentLine=2490371;
 //BA.debugLineNum = 2490371;BA.debugLine="If inppat.Show(\"\",\"Patient Nummer eingeben\",\"OK\",";
if (_inppat.Show("","Patient Nummer eingeben","OK","","",mostCurrent.activityBA,(android.graphics.Bitmap)(anywheresoftware.b4a.keywords.Common.Null))==anywheresoftware.b4a.keywords.Common.DialogResponse.CANCEL) { 
if (true) return "";};
RDebugUtils.currentLine=2490372;
 //BA.debugLineNum = 2490372;BA.debugLine="get_Pat(inppat.Input)";
_get_pat(_inppat.getInput());
RDebugUtils.currentLine=2490373;
 //BA.debugLineNum = 2490373;BA.debugLine="lblpatient.RequestFocus";
mostCurrent._lblpatient.RequestFocus();
RDebugUtils.currentLine=2490374;
 //BA.debugLineNum = 2490374;BA.debugLine="End Sub";
return "";
}
public static String  _btnenterpatid_longclick() throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "btnenterpatid_longclick", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "btnenterpatid_longclick", null));}
anywheresoftware.b4a.agraham.dialogs.InputDialog _inppat = null;
RDebugUtils.currentLine=2752512;
 //BA.debugLineNum = 2752512;BA.debugLine="Private Sub btnEnterPatID_LongClick";
RDebugUtils.currentLine=2752513;
 //BA.debugLineNum = 2752513;BA.debugLine="Dim inppat As InputDialog";
_inppat = new anywheresoftware.b4a.agraham.dialogs.InputDialog();
RDebugUtils.currentLine=2752514;
 //BA.debugLineNum = 2752514;BA.debugLine="inppat.InputType=inppat.INPUT_TYPE_TEXT";
_inppat.setInputType(_inppat.INPUT_TYPE_TEXT);
RDebugUtils.currentLine=2752515;
 //BA.debugLineNum = 2752515;BA.debugLine="If inppat.Show(\"\",\"Patient Name eingeben\",\"OK\",\"\"";
if (_inppat.Show("","Patient Name eingeben","OK","","",mostCurrent.activityBA,(android.graphics.Bitmap)(anywheresoftware.b4a.keywords.Common.Null))==anywheresoftware.b4a.keywords.Common.DialogResponse.CANCEL) { 
if (true) return "";};
RDebugUtils.currentLine=2752516;
 //BA.debugLineNum = 2752516;BA.debugLine="get_Pat_Name(inppat.Input)";
_get_pat_name(_inppat.getInput());
RDebugUtils.currentLine=2752517;
 //BA.debugLineNum = 2752517;BA.debugLine="lblpatient.RequestFocus";
mostCurrent._lblpatient.RequestFocus();
RDebugUtils.currentLine=2752518;
 //BA.debugLineNum = 2752518;BA.debugLine="End Sub";
return "";
}
public static void  _get_pat_name(String _searchstring) throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "get_pat_name", false))
	 {Debug.delegate(mostCurrent.activityBA, "get_pat_name", new Object[] {_searchstring}); return;}
ResumableSub_get_Pat_Name rsub = new ResumableSub_get_Pat_Name(null,_searchstring);
rsub.resume(processBA, null);
}
public static class ResumableSub_get_Pat_Name extends BA.ResumableSub {
public ResumableSub_get_Pat_Name(shub.dpm.barcodescanner parent,String _searchstring) {
this.parent = parent;
this._searchstring = _searchstring;
}
shub.dpm.barcodescanner parent;
String _searchstring;
shub.dpm.httpjob _job = null;
String _callurl = "";
String _res = "";
anywheresoftware.b4a.objects.collections.JSONParser _parser = null;
anywheresoftware.b4a.objects.collections.List _list1 = null;
anywheresoftware.b4a.objects.collections.Map _map1 = null;

@Override
public void resume(BA ba, Object[] result) throws Exception{
RDebugUtils.currentModule="barcodescanner";

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
RDebugUtils.currentLine=2293761;
 //BA.debugLineNum = 2293761;BA.debugLine="Dim job As HttpJob";
_job = new shub.dpm.httpjob();
RDebugUtils.currentLine=2293762;
 //BA.debugLineNum = 2293762;BA.debugLine="AllgFnkt.JobName=\"GetPatName\"";
parent.mostCurrent._allgfnkt._jobname /*String*/  = "GetPatName";
RDebugUtils.currentLine=2293763;
 //BA.debugLineNum = 2293763;BA.debugLine="job.Initialize(AllgFnkt.JobName, Me)";
_job._initialize /*String*/ (null,processBA,parent.mostCurrent._allgfnkt._jobname /*String*/ ,barcodescanner.getObject());
RDebugUtils.currentLine=2293764;
 //BA.debugLineNum = 2293764;BA.debugLine="Dim callurl As String = AllgFnkt.GetURL(searchstr";
_callurl = parent.mostCurrent._allgfnkt._geturl /*String*/ (mostCurrent.activityBA,_searchstring,"");
RDebugUtils.currentLine=2293765;
 //BA.debugLineNum = 2293765;BA.debugLine="job.Download(callurl)";
_job._download /*String*/ (null,_callurl);
RDebugUtils.currentLine=2293766;
 //BA.debugLineNum = 2293766;BA.debugLine="job.GetRequest.SetHeader(\"ApiKey\",AllgFnkt.apikey";
_job._getrequest /*anywheresoftware.b4h.okhttp.OkHttpClientWrapper.OkHttpRequest*/ (null).SetHeader("ApiKey",parent.mostCurrent._allgfnkt._apikey /*String*/ );
RDebugUtils.currentLine=2293767;
 //BA.debugLineNum = 2293767;BA.debugLine="Wait For (job) JobDone(job As HttpJob)";
anywheresoftware.b4a.keywords.Common.WaitFor("jobdone", processBA, new anywheresoftware.b4a.shell.DebugResumableSub.DelegatableResumableSub(this, "barcodescanner", "get_pat_name"), (Object)(_job));
this.state = 14;
return;
case 14:
//C
this.state = 1;
_job = (shub.dpm.httpjob) result[0];
;
RDebugUtils.currentLine=2293768;
 //BA.debugLineNum = 2293768;BA.debugLine="If job.Success Then";
if (true) break;

case 1:
//if
this.state = 13;
if (_job._success /*boolean*/ ) { 
this.state = 3;
}else {
this.state = 12;
}if (true) break;

case 3:
//C
this.state = 4;
RDebugUtils.currentLine=2293769;
 //BA.debugLineNum = 2293769;BA.debugLine="Dim res As String";
_res = "";
RDebugUtils.currentLine=2293770;
 //BA.debugLineNum = 2293770;BA.debugLine="res = job.GetString";
_res = _job._getstring /*String*/ (null);
RDebugUtils.currentLine=2293771;
 //BA.debugLineNum = 2293771;BA.debugLine="Dim parser As JSONParser";
_parser = new anywheresoftware.b4a.objects.collections.JSONParser();
RDebugUtils.currentLine=2293772;
 //BA.debugLineNum = 2293772;BA.debugLine="parser.Initialize(res)";
_parser.Initialize(_res);
RDebugUtils.currentLine=2293773;
 //BA.debugLineNum = 2293773;BA.debugLine="Dim list1 As List";
_list1 = new anywheresoftware.b4a.objects.collections.List();
RDebugUtils.currentLine=2293774;
 //BA.debugLineNum = 2293774;BA.debugLine="list1 = parser.NextArray";
_list1 = _parser.NextArray();
RDebugUtils.currentLine=2293775;
 //BA.debugLineNum = 2293775;BA.debugLine="If list1.Size<1 Then";
if (true) break;

case 4:
//if
this.state = 7;
if (_list1.getSize()<1) { 
this.state = 6;
}if (true) break;

case 6:
//C
this.state = 7;
RDebugUtils.currentLine=2293776;
 //BA.debugLineNum = 2293776;BA.debugLine="ToastMessageShow(\"Keine Daten gefunden\",True)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Keine Daten gefunden"),anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=2293777;
 //BA.debugLineNum = 2293777;BA.debugLine="AllgFnkt.PatID=0";
parent.mostCurrent._allgfnkt._patid /*String*/  = BA.NumberToString(0);
RDebugUtils.currentLine=2293778;
 //BA.debugLineNum = 2293778;BA.debugLine="lblpatient.Text=\"Patient nicht vorhanden.\"";
parent.mostCurrent._lblpatient.setText(BA.ObjectToCharSequence("Patient nicht vorhanden."));
RDebugUtils.currentLine=2293779;
 //BA.debugLineNum = 2293779;BA.debugLine="Return";
if (true) return ;
 if (true) break;
;
RDebugUtils.currentLine=2293781;
 //BA.debugLineNum = 2293781;BA.debugLine="If list1.Size=1 Then";

case 7:
//if
this.state = 10;
if (_list1.getSize()==1) { 
this.state = 9;
}if (true) break;

case 9:
//C
this.state = 10;
RDebugUtils.currentLine=2293782;
 //BA.debugLineNum = 2293782;BA.debugLine="Dim map1 As Map";
_map1 = new anywheresoftware.b4a.objects.collections.Map();
RDebugUtils.currentLine=2293783;
 //BA.debugLineNum = 2293783;BA.debugLine="map1 = list1.Get(0)";
_map1 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (anywheresoftware.b4a.objects.collections.Map.MyMap)(_list1.Get((int) (0))));
RDebugUtils.currentLine=2293784;
 //BA.debugLineNum = 2293784;BA.debugLine="AllgFnkt.PatID = map1.Get(\"id\")";
parent.mostCurrent._allgfnkt._patid /*String*/  = BA.ObjectToString(_map1.Get((Object)("id")));
RDebugUtils.currentLine=2293785;
 //BA.debugLineNum = 2293785;BA.debugLine="AllgFnkt.PatName=map1.Get(\"pat\")";
parent.mostCurrent._allgfnkt._patname /*String*/  = BA.ObjectToString(_map1.Get((Object)("pat")));
RDebugUtils.currentLine=2293786;
 //BA.debugLineNum = 2293786;BA.debugLine="lblpatient.Text=AllgFnkt.PatName";
parent.mostCurrent._lblpatient.setText(BA.ObjectToCharSequence(parent.mostCurrent._allgfnkt._patname /*String*/ ));
RDebugUtils.currentLine=2293787;
 //BA.debugLineNum = 2293787;BA.debugLine="Return";
if (true) return ;
 if (true) break;

case 10:
//C
this.state = 13;
;
RDebugUtils.currentLine=2293789;
 //BA.debugLineNum = 2293789;BA.debugLine="AllgFnkt.resultlist=list1";
parent.mostCurrent._allgfnkt._resultlist /*anywheresoftware.b4a.objects.collections.List*/  = _list1;
RDebugUtils.currentLine=2293790;
 //BA.debugLineNum = 2293790;BA.debugLine="StartActivity(\"ListPat\")";
anywheresoftware.b4a.keywords.Common.StartActivity(processBA,(Object)("ListPat"));
 if (true) break;

case 12:
//C
this.state = 13;
RDebugUtils.currentLine=2293792;
 //BA.debugLineNum = 2293792;BA.debugLine="ToastMessageShow(\"Funktionsaufruf fehlgeschlagen";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Funktionsaufruf fehlgeschlagen."),anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=2293793;
 //BA.debugLineNum = 2293793;BA.debugLine="Log(job.ErrorMessage)";
anywheresoftware.b4a.keywords.Common.LogImpl("12293793",_job._errormessage /*String*/ ,0);
 if (true) break;

case 13:
//C
this.state = -1;
;
RDebugUtils.currentLine=2293796;
 //BA.debugLineNum = 2293796;BA.debugLine="job.Release";
_job._release /*String*/ (null);
RDebugUtils.currentLine=2293798;
 //BA.debugLineNum = 2293798;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public static String  _btnlistdata_click() throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "btnlistdata_click", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "btnlistdata_click", null));}
RDebugUtils.currentLine=2686976;
 //BA.debugLineNum = 2686976;BA.debugLine="Private Sub btnListdata_Click";
RDebugUtils.currentLine=2686977;
 //BA.debugLineNum = 2686977;BA.debugLine="If AllgFnkt.PatID=0 Then";
if ((mostCurrent._allgfnkt._patid /*String*/ ).equals(BA.NumberToString(0))) { 
RDebugUtils.currentLine=2686978;
 //BA.debugLineNum = 2686978;BA.debugLine="ToastMessageShow(\"Bitte zuerst Patient auswählen";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Bitte zuerst Patient auswählen."),anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=2686979;
 //BA.debugLineNum = 2686979;BA.debugLine="Return";
if (true) return "";
 };
RDebugUtils.currentLine=2686981;
 //BA.debugLineNum = 2686981;BA.debugLine="AllgFnkt.pid=AllgFnkt.PatID";
mostCurrent._allgfnkt._pid /*String*/  = mostCurrent._allgfnkt._patid /*String*/ ;
RDebugUtils.currentLine=2686982;
 //BA.debugLineNum = 2686982;BA.debugLine="AllgFnkt.PatName=lblpatient.Text";
mostCurrent._allgfnkt._patname /*String*/  = mostCurrent._lblpatient.getText();
RDebugUtils.currentLine=2686983;
 //BA.debugLineNum = 2686983;BA.debugLine="StartActivity(\"ListData\")";
anywheresoftware.b4a.keywords.Common.StartActivity(processBA,(Object)("ListData"));
RDebugUtils.currentLine=2686985;
 //BA.debugLineNum = 2686985;BA.debugLine="End Sub";
return "";
}
public static String  _btnsearchpat_click() throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "btnsearchpat_click", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "btnsearchpat_click", null));}
anywheresoftware.b4a.agraham.dialogs.InputDialog _inppat = null;
RDebugUtils.currentLine=2424832;
 //BA.debugLineNum = 2424832;BA.debugLine="Private Sub btnSearchPat_Click";
RDebugUtils.currentLine=2424833;
 //BA.debugLineNum = 2424833;BA.debugLine="Dim inppat As InputDialog";
_inppat = new anywheresoftware.b4a.agraham.dialogs.InputDialog();
RDebugUtils.currentLine=2424834;
 //BA.debugLineNum = 2424834;BA.debugLine="If inppat.Show(\"Patient-Nr\",\"Patient Nummer einge";
if (_inppat.Show("Patient-Nr","Patient Nummer eingeben","OK","","",mostCurrent.activityBA,(android.graphics.Bitmap)(anywheresoftware.b4a.keywords.Common.Null))==anywheresoftware.b4a.keywords.Common.DialogResponse.CANCEL) { 
if (true) return "";};
RDebugUtils.currentLine=2424835;
 //BA.debugLineNum = 2424835;BA.debugLine="get_Pat(inppat.Input)";
_get_pat(_inppat.getInput());
RDebugUtils.currentLine=2424836;
 //BA.debugLineNum = 2424836;BA.debugLine="pattimer.Enabled=False";
mostCurrent._pattimer.setEnabled(anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=2424837;
 //BA.debugLineNum = 2424837;BA.debugLine="get_Pat(txtPatNr.Text)";
_get_pat(mostCurrent._txtpatnr.getText());
RDebugUtils.currentLine=2424840;
 //BA.debugLineNum = 2424840;BA.debugLine="pattimer.Enabled=True";
mostCurrent._pattimer.setEnabled(anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=2424841;
 //BA.debugLineNum = 2424841;BA.debugLine="End Sub";
return "";
}
public static String  _btnstartscan_click() throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "btnstartscan_click", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "btnstartscan_click", null));}
RDebugUtils.currentLine=2555904;
 //BA.debugLineNum = 2555904;BA.debugLine="Private Sub BtnStartScan_Click";
RDebugUtils.currentLine=2555905;
 //BA.debugLineNum = 2555905;BA.debugLine="If AllgFnkt.PatID=0 Then";
if ((mostCurrent._allgfnkt._patid /*String*/ ).equals(BA.NumberToString(0))) { 
RDebugUtils.currentLine=2555906;
 //BA.debugLineNum = 2555906;BA.debugLine="ToastMessageShow(\"Bitte zuerst Patient wählen\",T";
anywheresoftware.b4a.keywords.Common.ToastMessageShow(BA.ObjectToCharSequence("Bitte zuerst Patient wählen"),anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=2555907;
 //BA.debugLineNum = 2555907;BA.debugLine="Return";
if (true) return "";
 };
RDebugUtils.currentLine=2555909;
 //BA.debugLineNum = 2555909;BA.debugLine="AllgFnkt.JobEnabled=True";
mostCurrent._allgfnkt._jobenabled /*boolean*/  = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=2555910;
 //BA.debugLineNum = 2555910;BA.debugLine="bs1.startScanning";
mostCurrent._bs1.startScanning();
RDebugUtils.currentLine=2555911;
 //BA.debugLineNum = 2555911;BA.debugLine="pattimer.Enabled=False";
mostCurrent._pattimer.setEnabled(anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=2555912;
 //BA.debugLineNum = 2555912;BA.debugLine="End Sub";
return "";
}
public static String  _btnstopscan_click() throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "btnstopscan_click", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "btnstopscan_click", null));}
RDebugUtils.currentLine=2621440;
 //BA.debugLineNum = 2621440;BA.debugLine="Private Sub BtnStopScan_Click";
RDebugUtils.currentLine=2621441;
 //BA.debugLineNum = 2621441;BA.debugLine="Try";
try {RDebugUtils.currentLine=2621442;
 //BA.debugLineNum = 2621442;BA.debugLine="bs1.stopScanning";
mostCurrent._bs1.stopScanning();
 } 
       catch (Exception e4) {
			processBA.setLastException(e4); };
RDebugUtils.currentLine=2621445;
 //BA.debugLineNum = 2621445;BA.debugLine="Activity.Finish";
mostCurrent._activity.Finish();
RDebugUtils.currentLine=2621446;
 //BA.debugLineNum = 2621446;BA.debugLine="End Sub";
return "";
}
public static String  _timer_tick() throws Exception{
RDebugUtils.currentModule="barcodescanner";
if (Debug.shouldDelegate(mostCurrent.activityBA, "timer_tick", false))
	 {return ((String) Debug.delegate(mostCurrent.activityBA, "timer_tick", null));}
RDebugUtils.currentLine=2162688;
 //BA.debugLineNum = 2162688;BA.debugLine="Sub Timer_Tick";
RDebugUtils.currentLine=2162689;
 //BA.debugLineNum = 2162689;BA.debugLine="AllgFnkt.PatID=0";
mostCurrent._allgfnkt._patid /*String*/  = BA.NumberToString(0);
RDebugUtils.currentLine=2162690;
 //BA.debugLineNum = 2162690;BA.debugLine="lblpatient.Text=\"Bitte Patient auswählen\"";
mostCurrent._lblpatient.setText(BA.ObjectToCharSequence("Bitte Patient auswählen"));
RDebugUtils.currentLine=2162691;
 //BA.debugLineNum = 2162691;BA.debugLine="End Sub";
return "";
}
}