/// <summary> /// /// </summary> /// <param name="filePathAndName"></param> /// <returns></returns> public bool Run(string filePathAndName) { //instantiate modules var connection = new Functions.StatusArea.Statusbar.Statusbar_Functions(); var create = new Functions.Helpers.InterfaceHelpers.DeviceReportFunctions(); var devScreen = new Functions.ApplicationArea.Page_DeviceScreen.Page_DeviceScreen_Functions(); var dialog = new Functions.Helpers.DialogFunctions(); //check if device is connected Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Current task: Print Device Information"); if (connection.IsDeviceConnected()) { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Device is connected. Start printing device report..."); //press button device report devScreen.ClickFDTPrintButton(); // wait until window is open if (dialog.WaitForDeviceReportDialog()) { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Device Report created. Saving report..."); //click button print dialog.ClickPrintButton(); //check if print dialog is open if (dialog.IsPrintFormOpen()) { //select printer -> E+H FieldCare -> validate -> click print if (dialog.SelectFieldCarePrinter()) { //check if save dialog is open if (dialog.IsSaveDialogOpen()) { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Saving report in directory: '" + filePathAndName + "'"); //save dialog -> set filename and path bool exists = create.IsFileCreated(filePathAndName); if (exists) { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "The file already exists. It will be overwritten..."); } //check if text is set -> click save if (dialog.SaveReportWithName(filePathAndName, exists)) { //check if file was created if (create.IsFileCreated(filePathAndName)) { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "The file was created successfully"); return(true); } } } } } } } return(false); }
/// <summary> /// The run. /// </summary> /// <param name="filePath"> /// The file path. /// </param> /// <param name="fileName"> /// The file name. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public bool Run(string filePath, string fileName) { // instantiate all necessary modules var execFunction = new Functions.Helpers.InterfaceHelpers.DTMFunctions(); var connectionStatus = new Functions.StatusArea.Statusbar.Statusbar_Functions(); var devScreen = new Functions.ApplicationArea.Page_DeviceScreen.Page_DeviceScreen_Functions(); var dialog = new Functions.Helpers.DialogFunctions(); // set all necessary parameters devScreen.IsRestoreRequest = true; Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Current task: Restore device data"); if (connectionStatus.IsDeviceConnected()) { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Device is connected. Restoring device data..."); // click button "program functions" devScreen.OpenProgramFunctionsMenu(); // check if menu is open if (devScreen.IsDTMFunctionMenuShown()) { // select "restore device data" and then "browse" devScreen.RunDTMFunction(); // check if browse dialog is open if (dialog.IsBrowseDialogOpen()) { // construct the destination path string finalizedPath = filePath + "\\" + fileName + ".dcdtm"; // set filepath in the browse dialog dialog.SetFilePath(finalizedPath); // check if path is set if (dialog.IsFilePathSet(finalizedPath)) { // select "go" and then "ok" dialog.AckDialog(); // check if pop up dialog is open if (dialog.IsPopupOpen()) { // select yes in the pop up dialog dialog.AckPopup(); // wait for completion and check status area message for success/failure if (devScreen.IsRestoreFinished()) { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Restoring DTM data was successful"); return(true); } } } } } } return(false); }