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 ProfilePage() { InitializeComponent(); QContactDB qcdb = new QContactDB(); var pItems = new List <pItem>(); string fbId = Helpers.Settings.UserId; string keyId = fbId + "," + fbId; QContact qc = qcdb.GetQContact(keyId); if (qc == null) { qc = new QContact(); } var type = qc.GetType(); var properties = type.GetRuntimeProperties(); foreach (PropertyInfo prop in properties) { if (!prop.Name.Equals("myIdfriendId")) { pItem p = new pItem(); // Add space if (!prop.Name.Equals("LinkedIn")) { p.pName = Regex.Replace(prop.Name, "([a-z])_?([A-Z])", "$1 $2"); } else { p.pName = prop.Name; } if (p.pName.Equals("Birthday")) { if (prop.GetValue(qc, null) != null) { p.pValue = ((DateTime)prop.GetValue(qc, null)).ToLocalTime().ToString("MM/dd/yyyy"); } } else if (p.pName.Equals("LastModified")) { p.pValue = (((DateTime)prop.GetValue(qc, null)).ToString() + " UTC"); } else { p.pValue = prop.GetValue(qc, null) != null?prop.GetValue(qc, null).ToString() : ""; } pItems.Add(p); } } pListView.ItemsSource = pItems; pImage.Source = ImageSource.FromUri(new Uri("http://graph.facebook.com/" + fbId + "/picture?type=small")); }
public ProfileEditPage() { InitializeComponent(); QContactDB qcdb = new QContactDB(); QContact qc = qcdb.GetQContact(fbId + "," + fbId); if (qc != null) { showUsrData(qc); } }
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 QRCodePage() { InitializeComponent(); //get data from database var qc = qcdb.GetQContact(fbId + "," + fbId); string myJson = CreateUserJson(qc); stack = new StackLayout(); btn = new Button { Text = "Scan QR Code" }; barcode = new ZXingBarcodeImageView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; barcode.BarcodeFormat = ZXing.BarcodeFormat.QR_CODE; barcode.BarcodeOptions.Width = Device.OnPlatform(200, 250, 250); barcode.BarcodeOptions.Height = 250; barcode.BarcodeOptions.Margin = 10; barcode.BarcodeValue = myJson; btn.Clicked += BtnClickedEvent; stack.Children.Add(barcode); stack.Children.Add(btn); Content = stack; }
public ContactDetailPage(string keyId) { InitializeComponent(); QContactDB qcdb = new QContactDB(); var cdItems = new List <cdItem>(); this.keyId = keyId; QContact qc = qcdb.GetQContact(keyId); if (qc == null) { qc = new QContact(); } var type = qc.GetType(); var properties = type.GetRuntimeProperties(); foreach (PropertyInfo prop in properties) { if (!prop.Name.Equals("myIdfriendId")) { if (prop.Name.Equals("FirstName")) { cdLabel.Text += prop.GetValue(qc, null) != null?prop.GetValue(qc, null).ToString() : ""; cdLabel.Text += " "; } else if (prop.Name.Equals("LastName")) { cdLabel.Text += prop.GetValue(qc, null) != null?prop.GetValue(qc, null).ToString() : ""; } else { cdItem cd = new cdItem(); // Add space if (!prop.Name.Equals("LinkedIn")) { cd.cdName = Regex.Replace(prop.Name, "([a-z])_?([A-Z])", "$1 $2"); } else { cd.cdName = prop.Name; } // Not show the time, only show date if (cd.cdName.Equals("Birthday")) { if (prop.GetValue(qc, null) != null) { cd.cdValue = ((DateTime)prop.GetValue(qc, null)).ToLocalTime().ToString("MM/dd/yyyy"); } } else if (cd.cdName.Equals("LastModified")) { cd.cdValue = ((DateTime)prop.GetValue(qc, null)).ToString() + "UTC"; } else { cd.cdValue = prop.GetValue(qc, null) != null?prop.GetValue(qc, null).ToString() : ""; } cdItems.Add(cd); } } } cdListView.ItemsSource = cdItems; cdImage.Source = ImageSource.FromUri(new Uri("http://graph.facebook.com/" + qc.myIdfriendId.Split(',')[1] + "/picture?type=small")); }