Beispiel #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()
                    );
            }
Beispiel #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()
         );
 }
Beispiel #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(); };
        }
Beispiel #4
0
 public override void DidCancel(SIOverlayController overlayController, NSDictionary status)
 {
     Completion.SetResult(new ScanResult()
     {
         Success = false
     });
     Picker.StopScanning();
     Picker.DismissViewController(true, (Action)null);
 }
Beispiel #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 ();
			}
Beispiel #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()
                );
        }
Beispiel #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();
            }
Beispiel #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();
            }
        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());
        }
Beispiel #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()
			);
		}
Beispiel #12
0
 public override void DidCancel(SIOverlayController overlayController, NSDictionary status)
 {
     presentingViewController.DismissViewController(true, null);
 }
 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 ();
            }
Beispiel #18
0
 public override void DidCancel(SIOverlayController overlayController, NSDictionary status)
 {
     Console.WriteLine("Cancel was pressed.");
     presentingViewController.DismissViewController(true, null);
 }
Beispiel #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
		}
Beispiel #21
0
		public override void DidCancel (SIOverlayController overlayController, NSDictionary status) {
			presentingViewController.DismissViewController (true, null);
		}
Beispiel #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);
		}
Beispiel #25
0
 public override void DidCancel(SIOverlayController overlayController, NSDictionary status)
 {
     // Perform actions after cancel was pressed
 }
 public override void DidCancel(SIOverlayController overlayController, NSDictionary status)
 {
     Console.WriteLine(status.ToString());
 }
Beispiel #27
0
 public override void DidManualSearch(SIOverlayController overlayController, string text)
 {
     // Perform actions after search was used
 }
Beispiel #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
		}