public void ShowCompletedLabels() { int i; UILabel hfSectionPwrIds = (UILabel)View.ViewWithTag(iSectionRowsTagId * (m_iBatterySectionCounter+ 1)); int iTotalPwrIds = Convert.ToInt32(hfSectionPwrIds.Text); UILabel lblCompleted = (UILabel)View.ViewWithTag (iSectionCompleteLabelTagId * (m_iBatterySectionCounter + 1)); ProjectITPage QuestionsScreen = new ProjectITPage (); QuestionsScreen = GetProjectITPPage (); if(BatteryFullyComplete()) { lblCompleted.Hidden = false; for(i = 0 ; i< iTotalPwrIds ; i++) { UILabel lblPwrIdComplete = (UILabel)View.ViewWithTag ((iPwrIdSectionCompleteLabelTagId + (i+1)) * (m_iBatterySectionCounter+1)); lblPwrIdComplete.Hidden = false; } //Now also show it on the calling ITP screen QuestionsScreen.SetBatteryCompleted(true); } else { lblCompleted.Hidden = true; for(i = 0 ; i< iTotalPwrIds ; i++) { UILabel lblPwrId = (UILabel)View.ViewWithTag ((iPwrIdRowLabelTagId + (i+1)) * (m_iBatterySectionCounter+1)); string sPwrId = lblPwrId.Text; UILabel lblPwrIdComplete = (UILabel)View.ViewWithTag ((iPwrIdSectionCompleteLabelTagId + (i+1)) * (m_iBatterySectionCounter+1)); if(BatteryPwrIdComplete(sPwrId)) { lblPwrIdComplete.Hidden = false; } else { lblPwrIdComplete.Hidden = true; } } //Now also show it on the calling ITP screen QuestionsScreen.SetBatteryCompleted(false); } }
public void AddNewBatteryString(object sender, EventArgs e) { UIButton btnAddNew = (UIButton)sender; int iTagId = btnAddNew.Tag; int iPwrIdRow = iTagId /(m_iBatterySectionCounter+1) - iPwrIdNewBtnTagId; //This is 1 based UILabel hfThisPwrIdStringRows = (UILabel)View.ViewWithTag((ihfPwrIdStringRowsTagId + iPwrIdRow) * (m_iBatterySectionCounter + 1)); int iTotalStrings = Convert.ToInt32(hfThisPwrIdStringRows.Text); UILabel hfPwrId = (UILabel)View.ViewWithTag((iPwrIdRowLabelTagId + iPwrIdRow) * (m_iBatterySectionCounter+1)); string sPwrId = hfPwrId.Text; float iHeightToAdd = 0.0f; UIView BatteryStringRow = BuildBatteryStringRowDetails(m_iBatterySectionCounter, iPwrIdRow - 1, iTotalStrings, sPwrId, -1, -1, "", "", "","", "", "", "", "", "" ,"" , "","","N","", 0, 0, true, false, ref iHeightToAdd); //Get the position of the last row in this internal pwrId battery block UIView vwPwrInternalRowId = (UIView)View.ViewWithTag((iPwrIdSectionInnerTagId + (iPwrIdRow)) * (m_iBatterySectionCounter+1)); float iPwrIdRowVert = vwPwrInternalRowId.Frame.Height; BatteryStringRow.Frame = new RectangleF(0f, iPwrIdRowVert, 1000f, iHeightToAdd); BatteryStringRow.Tag = iStringFullRowTagId * (iPwrIdRow) + (iTotalStrings + 1); vwPwrInternalRowId.AddSubview(BatteryStringRow); RectangleF frame1 = vwPwrInternalRowId.Frame; frame1.Height += iHeightToAdd; vwPwrInternalRowId.Frame = frame1; //Now increase the view height for this new row (the whole section height is managed in the ReduceHeightAfter function) UILabel hfPwrIdSectionHeight = (UILabel)View.ViewWithTag((iPwrIdHeightTagId + iPwrIdRow ) * (m_iBatterySectionCounter + 1)); int iPwrIdHeight = Convert.ToInt32(hfPwrIdSectionHeight.Text); hfPwrIdSectionHeight.Text = (iPwrIdHeight + iHeightToAdd).ToString(); //Now increase the number of strings in the PwrId by 1 iTotalStrings++; hfThisPwrIdStringRows.Text = iTotalStrings.ToString(); ReduceHeightAfter(-iHeightToAdd, iPwrIdRow, iTotalStrings, 1); //Set the unsaved tags on SetSectionValueChanged(m_iBatterySectionCounter + 1); SetAnyValueChanged(sender, null); //Take off the completed or committed flags and also on the questions screen UILabel lblCompleted = (UILabel)View.ViewWithTag (iSectionCompleteLabelTagId * (m_iBatterySectionCounter + 1)); lblCompleted.Hidden = true; UILabel lblPwrIdComplete = (UILabel)View.ViewWithTag ((iPwrIdSectionCompleteLabelTagId + (iPwrIdRow)) * (m_iBatterySectionCounter+1)); lblPwrIdComplete.Hidden = true; ProjectITPage QuestionsScreen = new ProjectITPage (); QuestionsScreen = GetProjectITPPage (); QuestionsScreen.SetBatteryCompleted(false); //Enable the Save section button UIButton btnSave = (UIButton)View.ViewWithTag (iSaveSectionBtnTagId * (m_iBatterySectionCounter+1)); btnSave.Hidden = false; m_iValidateType = -1; //And move to the position UIScrollView scrollVw = (UIScrollView)View.ViewWithTag (2); float iTotalPosn = iPwrIdRowVert + scrollVw.ContentOffset.Y; PointF posn = new PointF(0f, iTotalPosn); scrollVw.SetContentOffset(posn, true); }