コード例 #1
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            switch (mTimesheetPeriod[position].GetListItemType())
            {
            case 1:
                TimesheetperiodViewHolder vh1 = holder as TimesheetperiodViewHolder;
                var periodAdapter             = new ArrayAdapter(main, AndroidApp1.Resource.Layout.select_dialog_item_material, (mTimesheetPeriod[position] as TimesheetPeriodModel).periodTemp);
                vh1.mPeriod.Adapter = periodAdapter;
                vh1.mPeriod.SetSelection((mTimesheetPeriod[position] as TimesheetPeriodModel).currentDayPosition);
                vh1.mPeriod.ItemSelected += (sender, e) =>
                {
                    frag.persist(e.Position);
                };
                if (mTimesheetPeriod.getBool() == false)
                {
                    vh1.mSettings.Click += delegate { frag.OpenSettings((mTimesheetPeriod[position] as TimesheetPeriodModel).currentDayPosition); };
                    mTimesheetPeriod.changeBool();
                }

                break;

            case 2:
                TimesheetLineViewHolder vh2 = holder as TimesheetLineViewHolder;
                vh2.mProjectName.Text = (mTimesheetPeriod[position] as TimesheetLineModel).ProjectName;
                vh2.mTaskName.Text    = (mTimesheetPeriod[position] as TimesheetLineModel).TaskName;
                vh2.mComment.Text     = (mTimesheetPeriod[position] as TimesheetLineModel).Comment;
                switch (Convert.ToInt32((mTimesheetPeriod[position] as TimesheetLineModel).BillingCategory))
                {
                case 0:
                    vh2.mBilling.Text = "Standard";
                    break;

                case 1:
                    vh2.mBilling.Text = "Sick Time";
                    break;

                case 2:
                    vh2.mBilling.Text = "Vacation";
                    break;

                case 3:
                    vh2.mBilling.Text = "Administrative";
                    break;
                }
                vh2.mStatus.Text    = (mTimesheetPeriod[position] as TimesheetLineModel).ProcessStatus;
                vh2.mTotalWork.Text = (mTimesheetPeriod[position] as TimesheetLineModel).TotalWork;
                if (!vh2.ItemView.HasOnClickListeners)
                {
                    vh2.ItemView.Click += (sender, e) => { frag.LongClick(position); }
                }
                ;

                break;
            }
        }