Esempio n. 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //
            // Get the person object from the intent
            //
            Person person;

            if (Intent.HasExtra("Person"))
            {
                var serializer  = new System.Xml.Serialization.XmlSerializer(typeof(Person));
                var personBytes = Intent.GetByteArrayExtra("Person");
                person = (Person)serializer.Deserialize(new MemoryStream(personBytes));
            }
            else
            {
                person = new Person();
            }

            //
            // Load the View Model
            //
            viewModel = new PersonViewModel(person, Android.Application.SharedFavoritesRepository);
            viewModel.PropertyChanged += HandleViewModelPropertyChanged;

            //
            // Setup the UI
            //
            ListView.Divider = null;
            ListAdapter      = new PersonAdapter(viewModel);

            Title = person.SafeDisplayName;
        }
        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            //
            // Get the person object from the intent
            //
            Person person;
            if (Intent.HasExtra ("Person")) {
                var serializer = new System.Xml.Serialization.XmlSerializer (typeof (Person));
                var personBytes = Intent.GetByteArrayExtra ("Person");
                person = (Person)serializer.Deserialize (new MemoryStream (personBytes));
            } else {
                person = new Person ();
            }

            //
            // Load the View Model
            //
            viewModel = new PersonViewModel (person, Android.Application.SharedFavoritesRepository);
            viewModel.PropertyChanged += HandleViewModelPropertyChanged;

            //
            // Setup the UI
            //
            ListView.Divider = null;
            ListAdapter = new PersonAdapter (viewModel);

            Title = person.SafeDisplayName;
        }