/// <summary> /// Validation if module (offline) is ready within a specified time /// </summary> /// <param name="timeOutInMilliseconds">Time within module should be ready</param> /// <returns> /// <br>True: if module is ready in time</br> /// <br>False: if module is not ready in time</br> /// </returns> public bool Run(int timeOutInMilliseconds) { bool result = true; Button read = new MainViewElements().ReadButton; Button write = new MainViewElements().WriteButton; var watch = new Stopwatch(); watch.Start(); // Wait until read and write buttons are enabled while (new IsModuleReady().IsModuleOnlineReady(read) == false || new IsModuleReady().IsModuleOnlineReady(write) == false || new ReadingAndWriting().IsReading()) { if (watch.ElapsedMilliseconds <= timeOutInMilliseconds) { continue; } result = false; break; } watch.Stop(); if (result) { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Module is ready after " + watch.ElapsedMilliseconds + " milliseconds. (Timeout: " + timeOutInMilliseconds + " milliseconds)"); } else { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Module is not ready after " + timeOutInMilliseconds + "Milliseconds."); } return(result); }
/// <summary> /// Set a text control to a specified value /// </summary> /// <param name="element">parameter to set</param> /// <param name="value">value to set</param> /// <returns> /// <br>True: if parameter was set</br> /// <br>Null: if an error occurred</br> /// </returns> private bool SetTextValue(Element element, string value) { if (element != null && element.Enabled) { element.Focus(); Mouse.MoveTo(element, 500); element.SetAttributeValue("Text", value); ////element.SetAttributeValue("FloatValue", value); // Try to set the focus on the connected status icon in the down left corner, this is needed since problems occurred after focusing textboxes Element tabcontrol = new MainViewElements().TabControl; if (tabcontrol == null) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Unable to set focus on the tabcontrol because the element is null"); } else { tabcontrol.Focus(); } return(true); } Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Text is not available."); return(false); }
/// <summary> /// Determines whether [write button is active]. /// </summary> /// <returns><c>true</c> if [write button is active]; otherwise, <c>false</c>.</returns> public bool IsWriteButtonActive() { bool result = false; Button write = new MainViewElements().WriteButton; if (write == null) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Write button is null"); } else { if (write.Enabled) { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Write button is active"); result = true; } else { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Write button is not active"); } } return(result); }
/// <summary> /// Mouse click on the button Write /// </summary> /// <returns> /// The <see cref="bool"/>. /// </returns> public bool Run() { bool result = true; Button button = new MainViewElements().WriteButton; if (button == null) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Write button is not accessible"); result = false; } else { if (button.Enabled == false) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Write button is not enabled, please check the preconditions"); result = false; } else { Mouse.MoveTo(button, 500); button.Click(DefaultValues.locDefaultLocation); Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Write button found and clicked"); } } return(result); }
/// <summary> /// Checks if button [About] is available /// </summary> /// <returns> /// <br>True: if module is ready</br> /// <br>False: if module is not ready</br> /// </returns> public bool Run() { bool result = true; Button button = new MainViewElements().CopyToClipboardButton; if (button == null) { result = false; } return(result); }
/// <summary> /// DTM Information -> Version /// </summary> /// <returns> /// The <see cref="string"/>. /// </returns> public string Version() { string result; Element element = new MainViewElements().DtmInformationVersion; if (element == null) { result = "The DTM Information-> Version is not accessible"; } else { result = element.GetAttributeValueText("Text"); } return(result); }
/// <summary> /// Device Type Information -> Name /// </summary> /// <returns> /// The <see cref="string"/>. /// </returns> public string Name() { string result; Element element = new MainViewElements().DeviceTypeInformationName; if (element == null) { result = "The Device Type Information-> Name is not accessible"; } else { result = element.GetAttributeValueText("Text"); } return(result); }
/// <summary> /// Setup Information -> Manufacturer /// </summary> /// <returns> /// The <see cref="string"/>. /// </returns> public string Manufacturer() { string result; Element element = new MainViewElements().SetupInformationManufacturer; if (element == null) { result = "The Setup Information-> Manufacturer is not accessible"; } else { result = element.GetAttributeValueText("Text"); } return(result); }
/// <summary> /// Checks if button [About] is available /// </summary> /// <returns> /// <br>True: if module is ready</br> /// <br>False: if module is not ready</br> /// </returns> public bool Run() { bool result = false; Button button = new MainViewElements().CopyToClipboardButton; if (button == null) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "The button [Copy To Clipboard] is not available"); } else { result = true; } return(result); }
/// <summary> /// Starts execution /// </summary> /// <returns> /// true if button is found and clicked, false if an error occurred /// </returns> public bool Run() { this.FocusOnAboutBox(); bool result = false; Button button = new MainViewElements().CopyToClipboardButton; if (button == null || button.Enabled == false) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Button [Copy To Clipboard] is not available"); } else { Mouse.Click(button); Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Button [Copy To Clipboard] found and clicked"); result = true; } return(result); }