void setUserName() { SCLAlertView alert = editionAlertView(); UITextField textField = alert.AddTextField("User name"); alert.AddButton("Send", () => { string text = textField.Text; NSUserDefaults.StandardUserDefaults.SetValueForKey(new NSString(text), new NSString("user.name")); var list = new List <KeyValuePair <string, string> >(); list.Add(new KeyValuePair <string, string>("user_name", text)); Accengage.UpdateDeviceInfo(list); }); var name = NSUserDefaults.StandardUserDefaults.ValueForKey(new NSString("user.name")); string subtitle = (name != null) ? "The current name is: " + name : ""; alert.ShowEdit(this.ParentViewController, "User's name", subtitle, "cancel", 0); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { SCLAlertView alert = new SCLAlertView(); UITextField textField = alert.AddTextField("Enter the quantity"); textField.KeyboardType = UIKeyboardType.NumberPad; UITextField textField2 = alert.AddTextField("Enter the price"); textField2.KeyboardType = UIKeyboardType.NumberPad; alert.ShouldDismissOnTapOutside = true; alert.CustomViewColor = UIColor.FromRGB(44, 147, 255); alert.HideAnimationType = SCLAlertViewHideAnimation.FadeOut; alert.ShowAnimationType = SCLAlertViewShowAnimation.FadeIn; alert.AddButton("Send", () => { if (textField.Text != "" && textField2.Text != "") { Console.WriteLine("Text Value: " + textField.Text); Int32 quantity = Int32.Parse(textField.Text); Double price = Double.Parse(textField2.Text); string product = "Product " + indexPath.Row.ToString(); AccengageItem accengageItem = new AccengageItem(product, "Brand", "Product", price, "EUR", quantity); List <AccengageItem> listItem = new List <AccengageItem>(); listItem.Add(accengageItem); Accengage.TrackPurchase("dePurchase", "EUR", quantity * price, listItem); } }); alert.ShowEdit(this.ParentViewController, "How much ?", "", "Cancel", 0); TableView.DeselectRow(indexPath, true); }
partial void ShowEdit(UIButton sender) { SCLAlertView alert = new SCLAlertView(); alert.ShowEdit(this, "Hello Edit", "This is a more descriptive text with edit textbox.", "OK", 0); }