Example #1
0
            public override void DidManualSearch(SIOverlayController overlayController, string text)
            {
                this._loadPop = new LoadingOverlay(UIScreen.MainScreen.Bounds);
                this.presentingViewController.View.Add(this._loadPop);
                picker.StopScanning();
                presentingViewController.DismissViewController(true, null);

                Task.Factory.StartNew(
                    // tasks allow you to use the lambda syntax to pass work
                    () => {
                    System.Threading.Thread.Sleep(1 * 1000);
                }
                    // ContinueWith allows you to specify an action that runs after the previous thread
                    // completes
                    //
                    // By using TaskScheduler.FromCurrentSyncrhonizationContext, we can make sure that
                    // this task now runs on the original calling thread, in this case the UI thread
                    // so that any UI updates are safe. in this example, we want to hide our overlay,
                    // but we don't want to update the UI from a background thread.
                    ).ContinueWith(
                    t => {
                    nsrView = new NameSearchResultView();
                    nsrView.setProductName(text.Trim());
                    presentingViewController.NavigationController.PushViewController(nsrView, true);
                    this._loadPop.Hide();
                }, TaskScheduler.FromCurrentSynchronizationContext()
                    );
            }
Example #2
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()
         );
 }
Example #3
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(); };
        }
Example #4
0
 public override void DidCancel(SIOverlayController overlayController, NSDictionary status)
 {
     Completion.SetResult(new ScanResult()
     {
         Success = false
     });
     Picker.StopScanning();
     Picker.DismissViewController(true, (Action)null);
 }
Example #5
0
 public override void DidScanBarcode(SIOverlayController overlayController, NSDictionary barcode)
 {
     // perform actions after a barcode was scanned
     Console.WriteLine("barcode scanned: {0}, '{1}'", barcode["symbology"], barcode["barcode"]);
     Completion.SetResult(new ScanResult()
     {
         Success = true,
         Code    = barcode ["barcode"].ToString()
     });
     Picker.StopScanning();
     Picker.DismissViewController(true, (Action)null);
 }
			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 ();
			}
Example #7
0
        public override void DidManualSearch(SIOverlayController overlayController, string text)
        {
            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 => {
                nsrView = new NameSearchResultView();
                nsrView.setProductName(text);
                presentingViewController.NavigationController.PushViewController(nsrView, true);
                this._loadPop.Hide();
            }, TaskScheduler.FromCurrentSynchronizationContext()
                );
        }
Example #8
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();
            }
Example #9
0
            public override void DidManualSearch(SIOverlayController overlayController, string text)
            {
                Console.WriteLine("Search was used.");

                // stop the camera
                picker.StopScanning();

                UIAlertView alert = new UIAlertView()
                {
                    Title = "User entered barcode", Message = "" + text
                };

                alert.AddButton("OK");

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

                alert.Show();
            }
Example #10
0
        public override void DidScanBarcode(SIOverlayController overlayController, NSDictionary barcode)
        {
            string code = barcode ["barcode"].ToString();

            if (kindOfScan == KindOfScan.Save)
            {
                if (saveVC == null)
                {
                    saveVC         = ownerVC.Storyboard.InstantiateViewController("SaveViewControllerID") as SaveViewController;
                    saveVC.IsShown = false;
                }

                if (saveVC.IsShown)
                {
                    return;
                }

                saveVC.Code = code;

                ownerVC.PresentViewController(saveVC, true, null);
            }
            else
            {
                var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;

                using (var db = new SQLiteConnection(appDelegate.DatabasePath)) {
                    var product = db.Table <Product> ().Where(p => p.Barcode == code).FirstOrDefault();

                    if (product != null)
                    {
                        new UIAlertView(product.Name, "The price of the product registered in the database is: " + product.Price.ToString(), null, "Ok", null).Show();
                    }
                    else
                    {
                        new UIAlertView("Mmm...", "It seems that the product hasn't been registered before...", null, "Ok", null).Show();
                    }
                }
            }

            Console.WriteLine(barcode.ToString());
        }
Example #11
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()
			);
		}
Example #12
0
 public override void DidCancel(SIOverlayController overlayController, NSDictionary status)
 {
     presentingViewController.DismissViewController(true, null);
 }
Example #13
0
 public override void DidManualSearch(SIOverlayController overlayController, string text)
 {
     Console.WriteLine(text);
 }
		public override void DidManualSearch (SIOverlayController overlayController, string text)
		{

		}
		public override void DidScanBarcode (SIOverlayController overlayController, NSDictionary barcode) {
			picker.StopScanning ();
			pdl = new ProductsInListView();
			pdl.setBarcode(barcode["barcode"].ToString());
			pickerControllerDelegate.scanned = true;
			presentingViewController.NavigationController.PopViewController (true);
		}
 public override void DidCancel(SIOverlayController overlayController, NSDictionary status)
 {
     Console.WriteLine ("Cancel was pressed.");
     presentingViewController.DismissViewController (true, null);
 }
            public override void DidManualSearch(SIOverlayController overlayController, string text)
            {
                Console.WriteLine ("Search was used.");

                // stop the camera
                picker.StopScanning ();

                UIAlertView alert = new UIAlertView () {
                    Title = "User entered barcode", Message = "" + text
                };
                alert.AddButton("OK");

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

                alert.Show ();
            }
Example #18
0
 public override void DidCancel(SIOverlayController overlayController, NSDictionary status)
 {
     Console.WriteLine("Cancel was pressed.");
     presentingViewController.DismissViewController(true, null);
 }
Example #19
0
			public override void DidManualSearch (SIOverlayController overlayController, string text) {
				this._loadPop = new LoadingOverlay (UIScreen.MainScreen.Bounds);
				this.presentingViewController.View.Add ( this._loadPop );
				picker.StopScanning ();
				presentingViewController.DismissViewController (true, null);

				Task.Factory.StartNew (
					// tasks allow you to use the lambda syntax to pass work
					() => {
						System.Threading.Thread.Sleep ( 1 * 1000 );
					}
					// ContinueWith allows you to specify an action that runs after the previous thread
					// completes
					// 
					// By using TaskScheduler.FromCurrentSyncrhonizationContext, we can make sure that 
					// this task now runs on the original calling thread, in this case the UI thread
					// so that any UI updates are safe. in this example, we want to hide our overlay, 
					// but we don't want to update the UI from a background thread.
				).ContinueWith ( 
					t => {
						nsrView = new NameSearchResultView();
						nsrView.setProductName (text.Trim());
						presentingViewController.NavigationController.PushViewController (nsrView, true);
						this._loadPop.Hide ();
					}, TaskScheduler.FromCurrentSynchronizationContext()
				);
			}
		public override void DidCancel (SIOverlayController overlayController, NSDictionary status) {
			// Perform actions after cancel was pressed
		}
Example #21
0
		public override void DidCancel (SIOverlayController overlayController, NSDictionary status) {
			presentingViewController.DismissViewController (true, null);
		}
Example #22
0
		public override void DidManualSearch (SIOverlayController overlayController, string text) {
			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 => {
					nsrView = new NameSearchResultView();
					nsrView.setProductName (text);
					presentingViewController.NavigationController.PushViewController (nsrView, true);
					this._loadPop.Hide ();
				}, TaskScheduler.FromCurrentSynchronizationContext()
			);
		}
		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(); };
		}
		public override void DidCancel (SIOverlayController overlayController, NSDictionary status) {
			presentingViewController.NavigationController.PopViewController (true);
		}
Example #25
0
 public override void DidCancel(SIOverlayController overlayController, NSDictionary status)
 {
     // Perform actions after cancel was pressed
 }
Example #26
0
 public override void DidCancel(SIOverlayController overlayController, NSDictionary status)
 {
     Console.WriteLine(status.ToString());
 }
Example #27
0
 public override void DidManualSearch(SIOverlayController overlayController, string text)
 {
     // Perform actions after search was used
 }
Example #28
0
 public override void DidManualSearch(SIOverlayController overlayController, string text)
 {
     //Do nothing
 }
		public override void DidManualSearch (SIOverlayController overlayController, string text) {
			// Perform actions after search was used
		}