You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:minWidth="25px" android:minHeight="25px" android:background="@android:color/transparent"> <LinearLayout android:orientation="horizontal" android:minWidth="25px" android:minHeight="25px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout1" android:layout_weight="0.3"> <TextView android:text="Place a barcode in the camera viewfinder to scan it. Barcode will scan Automatically." android:layout_width="wrap_content" android:layout_height="fill_parent" android:id="@+id/textView1" android:gravity="center" android:layout_weight="0" android:layout_marginRight="20dp" android:textSize="12sp" android:layout_marginLeft="5dp" android:background="@android:color/transparent" android:textColor="#ffffffff" /> </LinearLayout> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textView2" android:layout_weight="0.5" /> <LinearLayout android:orientation="vertical" android:minWidth="25px" android:minHeight="25px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout2" android:layout_weight="0.2" android:layout_gravity="center"> <TextView android:text="Try to avoid shadows and glare. Hold the device back about 6 inches from the barcode." android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textView3" android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:layout_gravity="center" android:textColor="#ffffffff" android:textSize="12sp" android:layout_weight="1" android:gravity="center" /> <TextView android:id="@+id/ticketInfo" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="24dp" android:maxLines="5" android:lines="5" android:singleLine="false" android:background="@color/colorWhite" android:textColor="@android:color/black"/> <Button android:text="@string/okButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorWhite" android:textColor="@android:color/black" android:id="@+id/okButton" /> </LinearLayout> </LinearLayout>
This is the code that starts the scan:
` MyButton_Scan.Click += async (sender, e) =>
{
var selectedEvent = string.Format("{0}", MyEventsSpinner.GetItemAtPosition(MyEventsSpinner.SelectedItemPosition));
if (selectedEvent.ToUpper() != "SELECT EVENT")
{
// Moved this here from mainActivity.cs in the off chance initialization was an issue
MobileBarcodeScanner.Initialize(Application);
scanner = new MobileBarcodeScanner();
scanner.UseCustomOverlay = true;
zxingOverlay = LayoutInflater.FromContext(this).Inflate(Resource.Layout.scanner, null);
MyTextView = zxingOverlay.FindViewById<TextView>(Resource.Id.ticketInfo);
MyTextView.Text = "";
MyScanScreenButton = zxingOverlay.FindViewById<Android.Widget.Button>(Resource.Id.okButton);
MyScanScreenButton.Text = "Clear";
MyScanScreenButton.Click += btnOk_Click;
scanner.CustomOverlay = zxingOverlay;
var opt = new MobileBarcodeScanningOptions();
opt.DelayBetweenContinuousScans = 5000;
//Start scanning
scanner.ScanContinuously(this, opt, HandleScanResult);
} else
{
Utils.showMessage("Please select an event from the drop down list");
}
};
`
Everytime I try to set the MyTextView text, it fails the first time to display anything, every subsequent run succeeds. I try to debug the issue and when I hit the line MyTextView.Text = MyMessage;, the dubugger stops and the program continues running, the second time through the text gets set and the debugger functions as expected. Something is going on with the scanner control. I've been focusing on the else section of the if (scanResult == "Y") and coded it so I could see what the web service was returning and the setting of the text. Again, it ALWAYS fails to set and display anything the first time I try to set it and then every subsequent attempt is successful. Any ideas? Or is this a bug?
The text was updated successfully, but these errors were encountered:
I have the following scanner custom overlay:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:minWidth="25px" android:minHeight="25px" android:background="@android:color/transparent"> <LinearLayout android:orientation="horizontal" android:minWidth="25px" android:minHeight="25px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout1" android:layout_weight="0.3"> <TextView android:text="Place a barcode in the camera viewfinder to scan it. Barcode will scan Automatically." android:layout_width="wrap_content" android:layout_height="fill_parent" android:id="@+id/textView1" android:gravity="center" android:layout_weight="0" android:layout_marginRight="20dp" android:textSize="12sp" android:layout_marginLeft="5dp" android:background="@android:color/transparent" android:textColor="#ffffffff" /> </LinearLayout> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textView2" android:layout_weight="0.5" /> <LinearLayout android:orientation="vertical" android:minWidth="25px" android:minHeight="25px" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout2" android:layout_weight="0.2" android:layout_gravity="center"> <TextView android:text="Try to avoid shadows and glare. Hold the device back about 6 inches from the barcode." android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textView3" android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:layout_gravity="center" android:textColor="#ffffffff" android:textSize="12sp" android:layout_weight="1" android:gravity="center" /> <TextView android:id="@+id/ticketInfo" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="24dp" android:maxLines="5" android:lines="5" android:singleLine="false" android:background="@color/colorWhite" android:textColor="@android:color/black"/> <Button android:text="@string/okButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorWhite" android:textColor="@android:color/black" android:id="@+id/okButton" /> </LinearLayout> </LinearLayout>
This is the code that starts the scan:
` MyButton_Scan.Click += async (sender, e) =>
{
var selectedEvent = string.Format("{0}", MyEventsSpinner.GetItemAtPosition(MyEventsSpinner.SelectedItemPosition));
if (selectedEvent.ToUpper() != "SELECT EVENT")
{
// Moved this here from mainActivity.cs in the off chance initialization was an issue
MobileBarcodeScanner.Initialize(Application);
`
This is the code that handles the scan result:
` void HandleScanResult(ZXing.Result result)
{
if (!popUpOpen)
{
Boolean ConversionGood = true;
Int32 convertedResult = 0;
Stream successbeepStream = GetType().Assembly.GetManifestResourceStream("eTicket_Scanner.beep.wav");
Stream failbeepStream = GetType().Assembly.GetManifestResourceStream("eTicket_Scanner.buzzer.wav");
try
{
convertedResult = Convert.ToInt32(result.Text);
}
catch (Exception ex)
{
ConversionGood = false;
bool isSuccess = _simpleAudioPlayer.Load(failbeepStream);
_simpleAudioPlayer.Play();
popUpOpen = true;
MyTextView.Text = "Not a valid ticket for this event.\nErrorif applicable): " + ex.Message;
MyTextView.SetBackgroundColor(Color.Red);
}
string scanResult = "";
if (ConversionGood)
{
scanResult = MyEventsService.VerifyScannedCode(MyUser.Username, MyUser.Password, currentEventID, convertedResult);
`
Everytime I try to set the MyTextView text, it fails the first time to display anything, every subsequent run succeeds. I try to debug the issue and when I hit the line MyTextView.Text = MyMessage;, the dubugger stops and the program continues running, the second time through the text gets set and the debugger functions as expected. Something is going on with the scanner control. I've been focusing on the else section of the if (scanResult == "Y") and coded it so I could see what the web service was returning and the setting of the text. Again, it ALWAYS fails to set and display anything the first time I try to set it and then every subsequent attempt is successful. Any ideas? Or is this a bug?
The text was updated successfully, but these errors were encountered: