Exemple #1
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            _dataTable = view.FindViewById <DataTableView>(Resource.Id.table);

            var tableMapping = DBAccess.GetMapping(typeof(City));

            _dataTable.TableName = tableMapping.TableName;
            _dataTable.SetColumnNames(tableMapping.Columns.Select(c => c.Name));

            _dataTable.SetMultiChoiceModeListener(this);
            _dataTable.SetQueryPreparedListener(this);
            _dataTable.ItemClick += (s, e) =>
            {
                Activity.FragmentManager.BeginTransaction()
                .AddToBackStack(null)
                .Replace(Resource.Id.frame_layout, CityRowFragment.Instantiate(e.Row.ID))
                .Commit();
            };

            _dataTable.LoadData();

            var addButton = view.FindViewById <FloatingActionButton>(Resource.Id.fab_add);

            addButton.Click += (s, e) =>
            {
                Activity.FragmentManager.BeginTransaction()
                .AddToBackStack(null)
                .Replace(Resource.Id.frame_layout, CityRowFragment.Instantiate())
                .Commit();
            };
        }
Exemple #2
0
        public static CityRowFragment Instantiate(int id)
        {
            var fragment = new CityRowFragment()
            {
                Arguments = new Bundle()
            };

            fragment.Arguments.PutInt("id", id);

            return(fragment);
        }