public void CheckPressureStatus() { PressureStatus newPressureStatus = GetNewPressureStatus(); if (newPressureStatus != CurrentPressureStatus) { CurrentPressureStatus = newPressureStatus; switch (newPressureStatus) { // Turn alarm ON for TOO_LOW, HIGH or TOO_HIGH case PressureStatus.TOO_LOW: case PressureStatus.TOO_HIGH: Is_ACK_Clicked = false; Acknowledge.Visible = true; ShouldWriteLog = true; break; // Turn alarm OFF for LOW or NORMAL case PressureStatus.LOW: case PressureStatus.NORMAL: case PressureStatus.HIGH: Is_ACK_Clicked = true; Acknowledge.Visible = false; ShouldWriteLog = false; break; } } }
private PressureStatus GetNewPressureStatus() { PressureStatus newPressureStatus = PressureStatus.NONE; if (Level_100 >= Common.LEVEL_TOO_LOW_MIN && Level_100 <= Common.LEVEL_TOO_LOW_MAX) { newPressureStatus = PressureStatus.TOO_LOW; } if (Level_100 >= Common.LEVEL_LOW_MIN && Level_100 <= Common.LEVEL_LOW_MAX) { newPressureStatus = PressureStatus.LOW; } if (Level_100 >= Common.LEVEL_NORMAL_MIN && Level_100 <= Common.LEVEL_NORMAL_MAX) { newPressureStatus = PressureStatus.NORMAL; } if (Level_100 >= Common.LEVEL_HIGH_MIN && Level_100 <= Common.LEVEL_HIGH_MAX) { newPressureStatus = PressureStatus.HIGH; } if (Level_100 >= Common.LEVEL_TOO_HIGH_MIN && Level_100 <= Common.LEVEL_TOO_HIGH_MAX) { newPressureStatus = PressureStatus.TOO_HIGH; } return(newPressureStatus); }