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 void TrackEvent(string eventName, Dictionary <string, string> properties, Dictionary <string, double> measurements) { NSMutableDictionary propertiesHelper = null; if (properties != null) { propertiesHelper = new NSMutableDictionary(); foreach (KeyValuePair <string, string> pair in properties) { propertiesHelper.Add(NSString.FromObject(pair.Key), NSString.FromObject(pair.Value)); } } NSMutableDictionary measurementsHelper = null; if (measurements != null) { measurementsHelper = new NSMutableDictionary(); foreach (KeyValuePair <string, double> pair in measurements) { measurementsHelper.Add(NSString.FromObject(pair.Key), NSNumber.FromDouble(pair.Value)); } } BITHockeyManager.SharedHockeyManager.MetricsManager.TrackEvent(eventName, propertiesHelper, measurementsHelper); }
public bool WriteFile(string name, string content) { var path = Path.Combine(docsPath, name); var str = NSString.FromObject(content) as NSString; var data = str.Encode(NSStringEncoding.UTF8); var result = data.Save(path, true); System.Diagnostics.Debug.WriteLine(string.Format("Write: {0}", result)); return(result); }
public async Task Show(string title, string message, string filePath) { var viewController = GetVisibleViewController(); var items = new NSObject[] { NSObject.FromObject(title), NSUrl.FromFilename(filePath), NSString.FromObject(message) }; var activityController = new UIActivityViewController(items, null); //needed? if (activityController.PopoverPresentationController != null) { activityController.PopoverPresentationController.SourceView = viewController.View; } await viewController.PresentViewControllerAsync(activityController, false); }
public override NSObject ObjectValueForItem(NSComboBox comboBox, nint index) { return(NSString.FromObject(source[(int)index])); }