private void LoadJobAdapter() { jobs = (List <Job>)database.GetItems(this, JOB_TABLE_NAME).Result; currentJobsListViewAdapter = new CurrentJobListViewAdapter(this, jobs.Where(j => j.Type == CURRENT_JOB_TYPE).ToList()); currentJobsListView.Adapter = currentJobsListViewAdapter; reserveJobsListViewAdapter = new ReserveJobListViewAdapter(this, jobs.Where(j => j.Type == RESERVE_JOB_TYPE).ToList()); reserveJobsListView.Adapter = reserveJobsListViewAdapter; works = (List <Work>)database.GetItems(this, WORK_TABLE_NAME).Result; List <Work> latestWorks = new List <Work>(); foreach (var work in works) { if (latestWorks.Any(w => w.WorkCode == work.WorkCode)) { latestWorks[latestWorks.FindIndex(w => w.WorkCode == work.WorkCode)] = work; } else { latestWorks.Add(work); } } mainLayoutRightDrawerWorksListView = FindViewById <ListView>(Resource.Id.mainLayoutRightDrawerWorksListView); mainLayoutRightDrawerWorksListViewAdapter = new WorkListViewAdapter(this, latestWorks, TAG); mainLayoutRightDrawerWorksListView.Adapter = mainLayoutRightDrawerWorksListViewAdapter; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_work); SetResult(Result.Canceled); toolbar = FindViewById <SupportToolbar>(Resource.Id.workToolbar); SetSupportActionBar(toolbar); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); // Create your application here database = new Database(); works = (List <Work>)database.GetItems(this, WORK_TABLE_NAME).Result; List <Work> latestWorks = new List <Work>(); foreach (var work in works) { if (latestWorks.Any(w => w.WorkCode == work.WorkCode)) { latestWorks[latestWorks.FindIndex(w => w.WorkCode == work.WorkCode)] = work; } else { latestWorks.Add(work); } } worksListView = FindViewById <ListView>(Resource.Id.worksListView); worksListViewAdapter = new WorkListViewAdapter(this, latestWorks, TAG); worksListView.Adapter = worksListViewAdapter; var workFloatingActionButton = FindViewById <FloatingActionButton>(Resource.Id.workFloatingActionButton); workFloatingActionButton.Click += WorkFloatingActionButton_Click; }
public void OnDismiss(IDialogInterface dialog) { works = (List <Work>)database.GetItems(this, WORK_TABLE_NAME).Result; worksListViewAdapter = new WorkListViewAdapter(this, works, TAG); worksListView.Adapter = worksListViewAdapter; }