/// <summary> /// Changes the channel assignment for a selected channel /// </summary> /// <param name="channelNumber">Channel for which channel assignment should be changed</param> /// <param name="inputValue">New channel assignment</param> /// <returns>true, if call worked; false if an error occurred</returns> public bool Run(int channelNumber, string inputValue) { Element comboBox; Element statusIcon; switch (channelNumber) { case 1: comboBox = new SettingsElements().ComboBoxAssignmentChannel1; statusIcon = new SettingsElements().StatusIconChannel1; if (new Settings().SetComboBoxValue(comboBox, inputValue, statusIcon)) { EH.PCPS.TestAutomation.Common.Tools.Log.Info( LogInfo.Namespace(MethodBase.GetCurrentMethod()), inputValue + " assigned to Channel 1"); return(true); } return(false); case 2: comboBox = new SettingsElements().ComboBoxAssignmentChannel2; statusIcon = new SettingsElements().StatusIconChannel2; if (new Settings().SetComboBoxValue(comboBox, inputValue, statusIcon)) { EH.PCPS.TestAutomation.Common.Tools.Log.Info( LogInfo.Namespace(MethodBase.GetCurrentMethod()), inputValue + " assigned to Channel 2"); return(true); } return(false); case 3: comboBox = new SettingsElements().ComboBoxAssignmentChannel3; statusIcon = new SettingsElements().StatusIconChannel3; if (new Settings().SetComboBoxValue(comboBox, inputValue, statusIcon)) { EH.PCPS.TestAutomation.Common.Tools.Log.Info( LogInfo.Namespace(MethodBase.GetCurrentMethod()), inputValue + " assigned to Channel 3"); return(true); } return(false); case 4: comboBox = new SettingsElements().ComboBoxAssignmentChannel4; statusIcon = new SettingsElements().StatusIconChannel4; if (new Settings().SetComboBoxValue(comboBox, inputValue, statusIcon)) { EH.PCPS.TestAutomation.Common.Tools.Log.Info( LogInfo.Namespace(MethodBase.GetCurrentMethod()), inputValue + " assigned to Channel 4"); return(true); } return(false); default: EH.PCPS.TestAutomation.Common.Tools.Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Wrong channel number"); return(false); } }
/// <summary> /// Creates a list with all possible channel assignments from the combo box assign channel 1 /// </summary> /// <returns> /// parameter List: when call worked fine /// null: if an error occurred /// </returns> public IList <ListItem> GetComboBoxValues() { Element comboBox = new SettingsElements().ComboBoxAssignmentChannel1; if (comboBox == null) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Combobox Assign Channel 1 is null"); return(null); } Mouse.MoveTo(comboBox, 500); Mouse.Click(comboBox); IList <ListItem> parameterList = new CommonElements().ListItemsComboBox; Mouse.Click(comboBox); return(parameterList); }
/// <summary> /// Clears the logging data. /// </summary> /// <param name="value"> /// The value. /// </param> /// <returns> /// <c>true</c> if XXXX, <c>false</c> otherwise. /// </returns> public bool ClearLoggingData(string value) { bool result; Element clearLoggingData = new SettingsElements().ComboBoxClearLoggingData; Element statusIcon = new SettingsElements().StatusIconClearLoggingData; if (clearLoggingData == null || statusIcon == null) { result = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Combo box clear logging data or its status icon is null."); } else { result = this.SetComboBoxValue(clearLoggingData, value, statusIcon); } return(result); }
/// <summary> /// Modifies the "Logging interval" parameter (tab Settings) /// </summary> /// <param name="inputValue"> /// new value for logging interval /// </param> /// <returns> /// true, if logging interval is set; false, if an error occurred /// </returns> public bool SetLoggingInterval(string inputValue) { try { string logInterval = this.SaveIntervall; Element editField = new SettingsElements().TextBoxSaveInterval; Element statusIcon = new SettingsElements().StatusIconLogInterval; if (editField != null) { Mouse.Click(editField); // Delete available value int count = logInterval.Length; for (int counter = 0; counter < count; counter++) { Keyboard.Press(Keys.Delete); } // Enter new value Keyboard.Press(inputValue); // Confirm changed parameter Keyboard.Press(Keys.Enter); return(new ParameterStates().WaitForParameterUpdate(statusIcon)); } Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Edit field Logging Interval is null"); return(false); } catch (Exception exception) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); return(false); } }