예제 #1
0
파일: ProjectList.cs 프로젝트: wyerp/csla
        private void LoadProjectList()
        {
            var projectList = FindViewById <ListView>(Resource.Id.lstProjects);
            var listAdapter = new Adapters.ProjectListAdapter(this, this.viewModel.Model);

            projectList.Adapter = listAdapter;
        }
예제 #2
0
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

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

            this.viewModel = new ProjectEditList();

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

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

            btnBack.Text       = Resources.GetString(Resource.String.ButtonBack);
            btnBack.Visibility = ViewStates.Visible;
            btnBack.Click     += btnBack_Click;

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

            try
            {
                await this.viewModel.LoadAsync();

                var projectList = FindViewById <ListView>(Resource.Id.lstProjects);

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