Esempio n. 1
0
 public override void DidScanBarcode(SIOverlayController overlayController, NSDictionary barcode)
 {
     this._loadPop = new LoadingOverlay(UIScreen.MainScreen.Bounds);
     this.presentingViewController.View.Add(this._loadPop);
     picker.StopScanning();
     presentingViewController.DismissViewController(true, null);
     Task.Factory.StartNew(
         () => {
         System.Threading.Thread.Sleep(1 * 1000);
     }
         ).ContinueWith(
         t => {
         if (barcode["symbology"].ToString().Equals("QR"))
         {
             newsListView = new NewsListView();
             newsListView.setStoreId(barcode["barcode"].ToString());
             presentingViewController.NavigationController.PushViewController(newsListView, true);
             this._loadPop.Hide();
         }
         else
         {
             pdView = new ProductStoresListView();
             pdView.setProduct(barcode["barcode"].ToString(), 0);
             presentingViewController.NavigationController.PushViewController(pdView, true);
             this._loadPop.Hide();
         }
     }, TaskScheduler.FromCurrentSynchronizationContext()
         );
 }
Esempio n. 2
0
        public override void DidScanBarcode(SIOverlayController overlayController, NSDictionary barcode)
        {
            qrScanner.StopScanning();

            // perform actions after a barcode was scanned
            Console.WriteLine("barcode scanned: {0}, '{1}'", barcode["symbology"], barcode["barcode"]);
            var barcodeString = NSString.FromObject(barcode ["barcode"]).ToString();
            var contactInfo   = barcodeString.Split(',');               // user id, first, last


            // TODO: temp code - move to view model
            var service         = TinyIoC.TinyIoCContainer.Current.Resolve <CouchbaseConnect2014.Services.ICouchbaseService> ();
            var contactId       = service.GetUserId();
            var contactExchange = new CouchbaseConnect2014.Models.ContactExchange()
            {
                LocalUserId = contactId,
                UserId      = contactInfo[0],
                First       = contactInfo[1],
                Last        = contactInfo[2]
            };
            var repo = TinyIoC.TinyIoCContainer.Current.Resolve <CouchbaseConnect2014.Services.IRepository> ();

            repo.SaveContactExchange(contactExchange);
            // end of temp code

            var message = string.Format("You have swapped contact info with {0} {1}.", contactInfo[1], contactInfo[2]);

            var contactAddedAlert = new UIAlertView("Swap Contacts", message, null, "Ok", null);

            contactAddedAlert.Show();

            contactAddedAlert.Clicked += (object sender, UIButtonEventArgs e) => { qrScanner.StartScanning(); };
        }
Esempio n. 3
0
            public override void DidScanBarcode(SIOverlayController overlayController, NSDictionary barcode)
            {
                Console.WriteLine("barcode scanned: {0}, '{1}'", barcode["symbology"], barcode["barcode"]);

                // stop the camera
                picker.StopScanning();

                UIAlertView alert = new UIAlertView()
                {
                    Title = barcode["symbology"] + " Barcode Detected", Message = "" + barcode["barcode"]
                };

                alert.AddButton("OK");

                alert.Clicked += (object sender, UIButtonEventArgs e) => {
                    picker.StartScanning();
                };

                alert.Show();
            }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            picker = new ScanditSDK.SIBarcodePicker (appKey);
            picker.OverlayController.DidScanBarcode += (object sender, SIOverlayControllerDidScanEventArgs e) => {
                picker.StopScanning ();
                ProcessBarcode (convertToNumber(e.Barcode ["barcode"].ToString ().ToUpper()));
            };
            picker.OverlayController.DidManualSearch += (object sender, SIOverlayControllerDidManualSearchEventArgs e) => {
                ProcessBarcode (convertToNumber(e.Text.ToUpper()));
            };
            picker.OverlayController.ShowSearchBar (true);
            picker.OverlayController.SetSearchBarKeyboardType (UIKeyboardType.ASCIICapable);
            picker.OverlayController.setSearchBarActionButtonCaption ("Search");
            View.AddSubview (picker.View);

            Shared.Database db = new Shared.Database();
            db.Initialize();
            int campusID = db.getCampusID();

            classPicker = new UIPickerView ();
            List<Area> Classes = dl.getSecureAreas (campusID).ToList();
            classPicker.Model = new Shared.ClassPickerViewModel (Classes);
            View.AddSubview (classPicker);

            eventPicker = new UIPickerView ();
            List<Event> Events = dl.getUpcomingEvents (campusID).ToList ();
            eventPicker.Model = new Shared.EventPickerViewModel (Events);
            View.AddSubview (eventPicker);

            checkInOut = new UISegmentedControl ();
            checkInOut.InsertSegment ("Check IN", 0, true);
            checkInOut.InsertSegment ("Check OUT", 1, true);
            checkInOut.SelectedSegment = 0;
            View.AddSubview (checkInOut);

            note = new UILabel ();
            note.Text = "Select the class and event you are checking kids INTO or OUT of:";
            View.AddSubview (note);

            picker.StartScanning ();
            ConfigureSizing ();
        }