Esempio n. 1
0
        private void LoadProjectResourceList()
        {
            var projectResourceList = FindViewById <ListView>(Resource.Id.lstProjectResources);
            var listAdapter         = new Adapters.ProjectResourceListAdapter(this, this.viewModel.Model);

            projectResourceList.Adapter = listAdapter;
        }
Esempio n. 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            SetContentView(Resource.Layout.ProjectResourceListEdit);

            var fraStatusContent = FindViewById <FrameLayout>(Resource.Id.fraProjectResourceListContent);

            this.viewModel = new ProjectResourceEditList();

            this.LayoutInflater.Inflate(Resource.Layout.Menu, fraStatusContent, true);

            var btnCancel = FindViewById <Button>(Resource.Id.btnFour);

            btnCancel.Text       = Resources.GetString(Resource.String.ButtonCancel);
            btnCancel.Visibility = ViewStates.Visible;
            btnCancel.Click     += btnCancel_Click;

            var btnOk = FindViewById <Button>(Resource.Id.btnThree);

            btnOk.Text       = Resources.GetString(Resource.String.ButtonOk);
            btnOk.Visibility = ViewStates.Visible;
            btnOk.Click     += btnOk_Click;

            if (this.viewModel.CanCreateObject)
            {
                var btnAddNew = FindViewById <Button>(Resource.Id.btnTwo);
                btnAddNew.Text       = Resources.GetString(Resource.String.ButtonAddNew);
                btnAddNew.Visibility = ViewStates.Visible;
                btnAddNew.Click     += btnAddNew_Click;
            }

            try
            {
                var parameter1 = Intent.GetByteArrayExtra(Constants.EditParameter);
                if (parameter1 != null)
                {
                    var projectEdit = (Library.ProjectEdit) this.DeserializeFromParameter(parameter1);
                    this.viewModel.LoadFromExisting(projectEdit.Resources);
                }
                else
                {
                    throw new NotImplementedException();
                }

                var projectResourceList = FindViewById <ListView>(Resource.Id.lstProjectResources);

                var listAdapter = new Adapters.ProjectResourceListAdapter(this, this.viewModel.Model);
                projectResourceList.Adapter    = listAdapter;
                projectResourceList.ItemClick += lstProjectResources_OnListItemClick;
            }
            catch (Exception ex)
            {
                ProgressDialog.Show(this, "Error", ex.Message + Csla.DataPortal.ProxyTypeName);
            }
        }