public void DemoReflectionApi () { if (settings == null){ var image = UIImage.FromFile ("monodevelop-32.png"); settings = new Settings () { AccountEnabled = true, Login = "******", TimeSamples = new TimeSettings () { Appointment = DateTime.Now, Birthday = new DateTime (1980, 6, 24), Alarm = new DateTime (2000, 1, 1, 7, 30, 0, 0) }, FavoriteType = TypeCode.Int32, Top = image, Middle = image, Bottom = image }; } var bc = new BindingContext (null, settings, "Settings"); var dv = new DialogViewController (bc.Root, true); // When the view goes out of screen, we fetch the data. dv.ViewDissapearing += delegate { // This reflects the data back to the object instance bc.Fetch (); // Manly way of dumping the data. Console.WriteLine ("Current status:"); Console.WriteLine ( "AccountEnabled: {0}\n" + "Login: {1}\n" + "Password: {2}\n" + "Appointment: {3}\n" + "Birthday: {4}\n" + "Alarm: {5}\n" + "Favorite Type: {6}\n", settings.AccountEnabled, settings.Login, settings.Password, settings.TimeSamples.Appointment, settings.TimeSamples.Birthday, settings.TimeSamples.Alarm, settings.FavoriteType); }; navigation.PushViewController (dv, true); }
public void DemoReflectionApi () { if (settings == null){ var image = UIImage.FromFile ("monodevelop-32.png"); settings = new Settings () { AccountEnabled = true, Login = "******", TimeSamples = new TimeSettings () { Appointment = DateTime.Now, Birthday = new DateTime (1980, 6, 24), Alarm = new DateTime (2000, 1, 1, 7, 30, 0, 0) }, FavoriteType = TypeCode.Int32, Top = image, Middle = image, Bottom = image, ListOfString = new List<string> () { "One", "Two", "Three" } }; } var cb = new Callbacks(); var bc = new BindingContext (cb, settings, "Settings"); cb.Initalize(bc); var dv = new DialogViewController (bc.Root, true); // When the view goes out of screen, we fetch the data. dv.ViewDisappearing += delegate { // This reflects the data back to the object instance bc.Fetch (); // Manly way of dumping the data. Console.WriteLine ("Current status:"); Console.WriteLine ( "AccountEnabled: {0}\n" + "Login: {1}\n" + "Password: {2}\n" + "Name: {3}\n" + "Appointment: {4}\n" + "Birthday: {5}\n" + "Alarm: {6}\n" + "Favorite Type: {7}\n" + "IEnumerable idx: {8}\n" + "I like ice cream: {9}\n" + "I like veggies: {10}\n" + "Animal kinds: {11}\n" + "Animal sizes: {12}", settings.AccountEnabled, settings.Login, settings.Password, settings.Name, settings.TimeSamples.Appointment, settings.TimeSamples.Birthday, settings.TimeSamples.Alarm, settings.FavoriteType, settings.selected, settings.LikeIceCream, settings.LikeVegetables, settings.Kinds, settings.Sizes); }; navigation.PushViewController (dv, true); }