private void ShowBrokenRule() { try { BrokenRuleInfo RuleInfo = brokenRuleMessage.RuleInfo; mainLinerLayout = (LinearLayout)this.FindViewById(Resource.Id.RuleBreakTable); relativeLayout = (RelativeLayout)LayoutInflater.From(this).Inflate(Resource.Layout.tableMobilePhone, null); TableTextView txt = (TableTextView)relativeLayout.FindViewById(Resource.Id.list_1_1); txt.SetText(RuleInfo.ExamItemName, TextView.BufferType.Normal); txt.SetTextColor(Color.Red); txt = (TableTextView)relativeLayout.FindViewById(Resource.Id.list_1_2); txt.SetText(RuleInfo.DeductedScores.ToString(), TextView.BufferType.Normal); txt.SetTextColor(Color.Red); txt = (TableTextView)relativeLayout.FindViewById(Resource.Id.list_1_3); txt.SetText(RuleInfo.RuleName, TextView.BufferType.Normal); txt.SetTextColor(Color.Red); mainLinerLayout.AddView(relativeLayout); } catch (Exception ex) { Logger.Error("ShowBorkenRule", ex.Message); } }
protected override void ShowBrokenRule() { try { BreakRuleIndex += 1; BrokenRuleInfo RuleInfo = brokenRuleMessage.RuleInfo; mainLinerLayout = (LinearLayout)this.FindViewById(Resource.Id.RuleBreakTable); LinearLayout linearLayout = (LinearLayout)LayoutInflater.From(this).Inflate(Resource.Layout.tableBeiKe, null); TableTextView txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_1); txt.SetText(BreakRuleIndex.ToString(), TextView.BufferType.Normal); txt.SetTextColor(Color.Red); txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_2); txt.SetText(RuleInfo.RuleName.ToString(), TextView.BufferType.Normal); txt.SetTextColor(Color.Red); txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_3); txt.SetText(RuleInfo.DeductedScores.ToString(), TextView.BufferType.Normal); txt.SetTextColor(Color.Red); txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_4); txt.SetText(RuleInfo.BreakTime.ToString("HH:mm:ss"), TextView.BufferType.Normal); txt.SetTextColor(Color.Red); txt = (TableTextView)linearLayout.FindViewById(Resource.Id.list_1_5); txt.SetText(RuleInfo.RuleCode, TextView.BufferType.Normal); txt.SetTextColor(Color.Red); mainLinerLayout.AddView(linearLayout); } catch (Exception ex) { Logger.Error("ShowBorkenRule", ex.Message); } }
//Remove之后进行刷新重新显示 private void ShowBrokenRule() { try { //我需要获取一个索引 mainLinerLayout = (LinearLayout)this.FindViewById(Resource.Id.RuleBreakTable); mainLinerLayout.RemoveAllViews(); BrokenRuleInfo RuleInfo = brokenRuleMessage.RuleInfo; lstRules.Add(RuleInfo); //lstRules.Reverse(); //todo:为什么要-1 ? for (int i = lstRules.Count; i > 0; i--) { //数组索引从0开始 var item = lstRules[i - 1]; relativeLayout = (LinearLayout)LayoutInflater.From(this).Inflate(Resource.Layout.tableNew, null); TableTextView txt = (TableTextView)relativeLayout.FindViewById(Resource.Id.list_1_1); txt.SetText(item.ExamItemName, TextView.BufferType.Normal); txt.SetTextColor(Color.Red); txt.Tag = item.Id.ToString(); txt.LongClick += Txt_LongClick; //txt.SetOnClickListener = (new View:O); txt = (TableTextView)relativeLayout.FindViewById(Resource.Id.list_1_2); txt.SetText(item.DeductedScores.ToString(), TextView.BufferType.Normal); txt.SetTextColor(Color.Red); txt = (TableTextView)relativeLayout.FindViewById(Resource.Id.list_1_3); txt.SetText(item.RuleName, TextView.BufferType.Normal); txt.SetTextColor(Color.Red); mainLinerLayout.AddView(relativeLayout); } } catch (Exception ex) { Logger.Error("ShowBorkenRule", ex.Message); } }
protected override void ShowBrokenRule() { try { BrokenRuleInfo RuleInfo = brokenRuleMessage.RuleInfo; var index = lstExamItem.ToList().IndexOf(RuleInfo.ExamItemName); var CurrentExamItemProcess = examProcess.GetExamProcess(RuleInfo.ExamItemCode); if (CurrentExamItemProcess == null) { CurrentExamItemProcess = new ExamItemProcess(); } CurrentExamItemProcess.IsSuccess = false; examProcess.AddExamItem(CurrentExamItemProcess); index = index > 0 ? index * 2 : index; mainLinerLayout = (LinearLayout)this.FindViewById(Resource.Id.ExamItemTable); //通过索引获取子View var examItemView = (LinearLayout)mainLinerLayout.GetChildAt(index); imgExamStatus = examItemView.FindViewById <ImageView>(Resource.Id.imgExamStatus); tvExamInfo = examItemView.FindViewById <TextView>(Resource.Id.tvExamInfo); imgExamStatus.SetImageResource(imgExamFailResId); tvExamInfo.Text = GetExamInfo(RuleInfo.DeductedScores); //添加扣分规则 linearLayout = (LinearLayout)LayoutInflater.From(this).Inflate(Resource.Layout.tableKeFeiTeBreakeRule, null); tvExamCode = linearLayout.FindViewById <TextView>(Resource.Id.tvExamCode); tvRuleScore = linearLayout.FindViewById <TextView>(Resource.Id.tvRuleScore); tvRuleContent = linearLayout.FindViewById <TextView>(Resource.Id.tvRuleContent); tvExamCode.Text = RuleInfo.ExamItemCode; tvRuleScore.Text = RuleInfo.DeductedScores.ToString(); tvRuleContent.Text = RuleInfo.RuleName; examItemView.AddView(linearLayout); } catch (Exception ex) { Logger.Error(ex, this.GetType().ToString()); } }
public BrokenRuleMessage(BrokenRuleInfo ruleInfo) { RuleInfo = ruleInfo; }