public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. BtnSharedSave.TouchUpInside += delegate { sobj = new SharedClass(this); sobj.Show(); }; btnPCLSave.TouchUpInside += delegate { pobj = new PortableClass(); pobj.OnShow += delegate { UIAlertController alert = UIAlertController.Create("Message", "Data Saved", UIAlertControllerStyle.Alert); // Configure the alert alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, (action) => { })); // Display the alert this.PresentViewController(alert, true, null); }; pobj.Show(); }; BtnPCLInterface.TouchUpInside += delegate { pobj = new PortableClass(); pobj.ShowAlert(new AlertView(this)); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button1 = FindViewById<Button>(Resource.Id.SharedButton); button1.Click += delegate { sobj = new SharedClass(this); sobj.Show(); }; Button button2 = FindViewById<Button>(Resource.Id.PCLButton); button2.Click += delegate { pobj = new PortableClass(); pobj.OnShow += delegate { Toast.MakeText(this, "Data Saved", ToastLength.Long).Show(); }; pobj.Show(); }; Button button3 = FindViewById<Button>(Resource.Id.PCLInterfaceButton); button3.Click += delegate { pobj = new PortableClass(); pobj.ShowAlert(new AlertView(this)); }; }