public void ShowCompletedLabels() { int i; UILabel hfSectionPwrIds = (UILabel)View.ViewWithTag(iSectionRowsTagId * (m_iEquipmentSectionCounter+ 1)); int iTotalPwrIds = Convert.ToInt32(hfSectionPwrIds.Text); UILabel lblCompleted = (UILabel)View.ViewWithTag (iSectionCompleteLabelTagId * (m_iEquipmentSectionCounter + 1)); ProjectITPage QuestionsScreen = new ProjectITPage (); QuestionsScreen = GetProjectITPPage (); if(PowerConversionFullyComplete()) { lblCompleted.Hidden = false; for(i = 0 ; i< iTotalPwrIds ; i++) { UILabel lblPwrIdComplete = (UILabel)View.ViewWithTag ((iPwrIdSectionCompleteLabelTagId + (i+1)) * (m_iEquipmentSectionCounter+1)); lblPwrIdComplete.Hidden = false; } //Now also show it on the calling ITP screen QuestionsScreen.SetPowerConversionCompleted(true); } else { lblCompleted.Hidden = true; for(i = 0 ; i< iTotalPwrIds ; i++) { UILabel lblPwrId = (UILabel)View.ViewWithTag ((iPwrIdRowLabelTagId + (i+1)) * (m_iEquipmentSectionCounter+1)); string sPwrId = lblPwrId.Text; UILabel lblPwrIdComplete = (UILabel)View.ViewWithTag ((iPwrIdSectionCompleteLabelTagId + (i+1)) * (m_iEquipmentSectionCounter+1)); if(PowerConversionPwrIdComplete(sPwrId)) { lblPwrIdComplete.Hidden = false; } else { lblPwrIdComplete.Hidden = true; } } //Now also show it on the calling ITP screen QuestionsScreen.SetPowerConversionCompleted(false); } }
public void CheckUnsaved() { //First of all validate anything required switch(m_iValidateType) { case 1: //Floor if(!ValidateFloor(m_sender, 1)) { gbSuppressSecondCheck = false; return; } break; case 2: //Suite if(!ValidateSuite(m_sender, 1)) { gbSuppressSecondCheck = false; return; } break; case 3: //Rack if(!ValidateRack(m_sender, 1)) { gbSuppressSecondCheck = false; return; } break; case 4: //SubRack if(!ValidateSubRack(m_sender, 1)) { gbSuppressSecondCheck = false; return; } break; case 5: //Position if(!ValidatePosition(m_sender, 1)) { gbSuppressSecondCheck = false; return; } break; case 6: //Solar String if(!ValidateBankNo(m_sender, 2, 1)) { gbSuppressSecondCheck = false; return; } break; case 7: //DOM if(!ValidateDOM(m_sender, 1)) { gbSuppressSecondCheck = false; return; } break; case 8: //Serial No if(!ValidateSerialNo(m_sender, 1)) { gbSuppressSecondCheck = false; return; } break; case 9: //Maximo Asset Id if(!ValidateMaximoAssetId(m_sender, 1)) { gbSuppressSecondCheck = false; return; } break; } UILabel txtEditStatus = (UILabel)View.ViewWithTag (80); int iStatus = Convert.ToInt32 (txtEditStatus.Text); if (iStatus == 0) { ProjectITPage QuestionsScreen = new ProjectITPage (); QuestionsScreen = GetProjectITPPage (); this.NavigationController.PopToViewController (QuestionsScreen, true); } else { //Ask the question iUtils.AlertBox alert2 = new iUtils.AlertBox(); alert2.CreateAlertYesNoCancelDialog(); alert2.SetAlertMessage("You have unsaved changes. Do you wish to save these changes before going back to the downloaded screen?"); alert2.ShowAlertBox(); UIAlertView alert3 = alert2.GetAlertDialog(); alert3.Clicked += (sender2, e2) => {CheckSaveChangesQuestion(sender2, e2, e2.ButtonIndex);}; } }
public void CheckSaveChangesQuestion(object sender, EventArgs e, int iBtnIndex) { ProjectITPage QuestionsScreen = new ProjectITPage (); QuestionsScreen = GetProjectITPPage (); switch (iBtnIndex) { case 0: SaveAllSections(); this.NavigationController.PopToViewController (QuestionsScreen, true); break; case 1: this.NavigationController.PopToViewController (QuestionsScreen, true); break; case 2: break; } }
public void AddNewItem(object sender, EventArgs e, int iBtnIndex, int iPwrIdRow) { int iEquipmentType = 5; float iHeightToAdd = 0.0f; UILabel hfThisPwrIdStringRows = (UILabel)View.ViewWithTag((ihfPwrIdStringRowsTagId + iPwrIdRow) * (m_iEquipmentSectionCounter + 1)); int iTotalStrings = Convert.ToInt32(hfThisPwrIdStringRows.Text); UILabel hfPwrId = (UILabel)View.ViewWithTag((iPwrIdRowLabelTagId + iPwrIdRow) * (m_iEquipmentSectionCounter+1)); string sPwrId = hfPwrId.Text; switch (iBtnIndex) { case 0: //Rack iEquipmentType = 3; break; case 1: //SubRack iEquipmentType = 4; break; case 2: //Postion iEquipmentType = 5; break; case 3: //String iEquipmentType = 7; break; } UIView EquipmentItemRow = BuildEquipmentItemRowDetails(m_iEquipmentSectionCounter, iPwrIdRow - 1, iTotalStrings, sPwrId, -1, -1, "", "", "", "", "", "", "", "", "", "", "N", "", iEquipmentType, -1, false, false,ref iHeightToAdd); //Get the position of the last row in this internal pwrId battery block UIView vwPwrInternalRowId = (UIView)View.ViewWithTag((iPwrIdSectionInnerTagId + (iPwrIdRow)) * (m_iEquipmentSectionCounter+1)); float iPwrIdRowVert = vwPwrInternalRowId.Frame.Height; EquipmentItemRow.Frame = new RectangleF(0f, iPwrIdRowVert, 1000f, iHeightToAdd); EquipmentItemRow.Tag = iEquipmentFullRowTagId * (iPwrIdRow) + (iTotalStrings + 1); vwPwrInternalRowId.AddSubview(EquipmentItemRow); 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_iEquipmentSectionCounter + 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, 2); //Set the unsaved tags on SetSectionValueChanged(m_iEquipmentSectionCounter + 1); SetAnyValueChanged(sender, null); //Take off the completed or committed flags and also on the questions screen UILabel lblCompleted = (UILabel)View.ViewWithTag (iSectionCompleteLabelTagId * (m_iEquipmentSectionCounter + 1)); lblCompleted.Hidden = true; UILabel lblPwrIdComplete = (UILabel)View.ViewWithTag ((iPwrIdSectionCompleteLabelTagId + (iPwrIdRow)) * (m_iEquipmentSectionCounter+1)); lblPwrIdComplete.Hidden = true; ProjectITPage QuestionsScreen = new ProjectITPage (); QuestionsScreen = GetProjectITPPage (); QuestionsScreen.SetPowerConversionCompleted(false); //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); }
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); }
public void OpenITPTask(object sender, EventArgs e) { this.InvokeOnMainThread(() => { UIButton btnOpen = (UIButton)sender; int iOpenITPId = btnOpen.Tag; UILabel projId = (UILabel)View.ViewWithTag (iOpenITPId/iOpenBtnTagId*iProjectIdTagId); string sId = projId.Text; m_PassedId = sId; UILabel projDesc = (UILabel)View.ViewWithTag (iOpenITPId/iOpenBtnTagId*iProjectDescTagId); string sProjDesc = projDesc.Text; m_PassedDesc = sProjDesc; ProjectITPage projITPScreen = new ProjectITPage(); // this.NavigationController.NavigationBarHidden = true; this.NavigationController.PushViewController(projITPScreen, true); prog.StopAnimating(); prog.CloseActivityIndicator(); ReEnableButtons(); }); }