public async void onCExportClicked(object sender, EventArgs args) { IAddContactsInfo addContacts = DependencyService.Get <IAddContactsInfo>(); //get the selected contact list List <cItem> selectedList = new List <cItem>(); bool hasChecked = false; foreach (cItem c in clist) { Debug.WriteLine(c.cChecked); if (c.cChecked == true) { selectedList.Add(c); hasChecked = true; //export data QContact qc = qcdb.GetQContact(c.cId); addContacts.AddContacts(qc); } } if (hasChecked) { await DisplayAlert("Confirm", "The contact information has been sucessfully exported", "OK"); var qcs = qcdb.GetQContacts(fbId); ShowContacts((List <QContact>)qcs); cMultiSelect.IsToggled = false; } else { await DisplayAlert("Alert", "No items selected", "OK"); } }
public async void onCdExportClicked(object sender, EventArgs args) { // export data to mobile contacts // export data to contacts IAddContactsInfo addContacts = DependencyService.Get <IAddContactsInfo>(); QContactDB qcdb = new QContactDB(); QContact qc = qcdb.GetQContact(keyId); Debug.WriteLine(qc.FirstName); bool exResult = addContacts.AddContacts(qc); if (exResult) { await DisplayAlert("Confirm", "The contact information has been sucessfully exported", "OK"); } else { await DisplayAlert("ERROR", "Exporting Fail", "OK"); } await Navigation.PopAsync(); }
public QRScanPage() { InitializeComponent(); Padding = Device.OnPlatform(new Thickness(0, 20, 0, 0), new Thickness(), new Thickness()); zxing = new ZXingScannerView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; zxing.OnScanResult += (result) => Device.BeginInvokeOnMainThread(async() => { // Stop analysis until we navigate away so we don't keep reading barcodes zxing.IsAnalyzing = false; zxing.IsScanning = false; // Store result to db string name = AddToDB(result.Text); var answer = await DisplayAlert("Message", name + " Scanned!", "Done", "Export"); // Export if (!answer) { // export data to contacts IAddContactsInfo addContacts = DependencyService.Get <IAddContactsInfo>(); bool exResult = addContacts.AddContacts(qc); if (exResult) { await DisplayAlert("Confirm", "The contact information has been sucessfully exported", "OK"); } else { await DisplayAlert("ERROR", "Exporting Fail", "OK"); } } // Navigate away await Navigation.PopModalAsync(); }); overlay = new ZXingDefaultOverlay { TopText = "Hold your phone up to the barcode", BottomText = "Scanning will happen automatically", ShowFlashButton = false }; var grid = new Grid(); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition { Height = 50 }); Button cancelBtn = new Button { Text = "Cancel", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; cancelBtn.Clicked += OnCancelBtnClicked; grid.Children.Add(zxing, 0, 0); grid.Children.Add(overlay, 0, 0); grid.Children.Add(cancelBtn, 0, 1); // The root page of your application Content = grid; }