private TableRow GetDeductionRuleTableRow(TwoPole.Chameleon3.Domain.DeductionRule item) { TableRow tableRow = (TableRow)LayoutInflater.From(this).Inflate(Resource.Layout.tableArtificialEvaluation, null); TextView tvDeductionReason = (TextView)tableRow.FindViewById(Resource.Id.tvDeductionReason); TextView tvDeductionScore = (TextView)tableRow.FindViewById(Resource.Id.tvDeductionScore); tvDeductionReason.Text = item.DeductedReason; tvDeductionScore.Text = item.DeductedScores.ToString(); return(tableRow); }
private void EditDeductionRule(Domain.DeductionRule deductionRule) { View view = View.Inflate(this, Resource.Layout.Dialog_DeductionRuleUpdate, null); EditText edtDeductionContent = (EditText)view.FindViewById(Resource.Id.edtDeductionContent); EditText edtDeductionScore = (EditText)view.FindViewById(Resource.Id.edtDeductionScore); CheckBox chkIsRequired = (CheckBox)view.FindViewById(Resource.Id.chkIsDeduction); //进行一个数据绑定 edtDeductionContent.Text = deductionRule.DeductedReason; edtDeductionScore.Text = deductionRule.DeductedScores.ToString(); chkIsRequired.Checked = deductionRule.IsRequired; builder = new AlertDialog.Builder(this); alertDialog = builder .SetTitle("编辑扣分规则") .SetView(view) .SetNegativeButton("取消", (s, e) => { }) .SetPositiveButton("确定", (s, e) => { //保存地图记录地图 deductionRule.DeductedReason = edtDeductionContent.Text.Trim(); deductionRule.DeductedScores = Convert.ToInt32(edtDeductionScore.Text); deductionRule.IsRequired = chkIsRequired.Checked; dataService.UpdateDeductionRules(deductionRule); InitDeductionRule(ItemCode); //取消对话框显示 alertDialog.Cancel(); }) .Create(); //创建alertDialog对象 alertDialog.Show(); DisplayMetrics dm = new DisplayMetrics(); base.WindowManager.DefaultDisplay.GetMetrics(dm); alertDialog.Window.SetLayout(dm.WidthPixels / 4 * 3, dm.HeightPixels / 4 * 3); }