/// <summary>
        /// Checks DTM messages for a critical error
        /// </summary>
        /// <returns>List with critical error message or list with empty string.</returns>
        public List <string> Run()
        {
            Logging.Enter(this, MethodBase.GetCurrentMethod().Name);

            bool          result;
            List <string> resultStrings;

            result  = Functions.Dialogs.Execution.EventLog.OpenEventLog();
            result &= Functions.Dialogs.Validation.EventLog.IsEventLogOpen();

            resultStrings = Functions.Dialogs.Execution.EventLog.GetAllCriticalErrorFromEventLog();
            if (resultStrings.Count == 0)
            {
                Reporting.Debug("No Critical Error found.");
                resultStrings.Add(string.Empty);
            }

            result &= Functions.Dialogs.Execution.EventLog.CloseEventLog();
            result &= Functions.Dialogs.Validation.EventLog.IsEventLogClosed();

            if (!result)
            {
                Reporting.Debug("An error occured while GetCritical Error");
            }

            return(resultStrings);
        }
        /// <summary>
        /// The run.
        /// </summary>
        /// <returns>
        /// The <see cref="List"/>.
        /// </returns>
        public List <string> Run()
        {
            Logging.Enter(this, MethodBase.GetCurrentMethod().Name);

            List <string> messages = null;

            if (Functions.Dialogs.Execution.EventLog.OpenEventLog())
            {
                messages = Functions.Dialogs.Execution.EventLog.GetAllMessagesFromEventLog();
                if (messages != null)
                {
                    if (messages.Count > 0)
                    {
                        foreach (var message in messages)
                        {
                            Reporting.Debug(message);
                        }
                    }
                    else
                    {
                        Reporting.Debug("There isn´t any message in Event Log available");
                    }
                }
                else
                {
                    Reporting.Debug("There isn´t any message in Event Log available");
                }
            }

            return(messages);
        }
Esempio n. 3
0
        /// <summary>
        /// The wait until status message becomes available.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool WaitUntilStatusMessageBecomesAvailable()
        {
            Logging.Enter(typeof(ProgressIndicator), MethodBase.GetCurrentMethod().Name);

            try
            {
                DeviceCareApplication repo = DeviceCareApplication.Instance;
                repo.StatusArea.ProgressIndicatorInfo.WaitForExists(Common.DefaultValues.GeneralTimeout);
                Reporting.Debug("Progress Indicator is available.");
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();

                while (stopwatch.ElapsedMilliseconds < Common.DefaultValues.GeneralTimeout)
                {
                    if (IsStatusMessageAvailable())
                    {
                        repo.StatusArea.ProgressIndicator.MoveTo();
                        Reporting.Debug("Status Message is available.");
                        return(true);
                    }
                }

                Reporting.Error(string.Format("Status Message is not available after {0} miliseconds.", Common.DefaultValues.GeneralTimeout));
                return(false);
            }
            catch (Exception exception)
            {
                Reporting.Error(exception.Message);
                return(false);
            }
        }
        /// <summary>
        /// The is progress indicator available.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool WaitUntilProgressIndicatorBecomesNotAvailable()
        {
            Logging.Enter(typeof(ProgressIndicator), MethodBase.GetCurrentMethod().Name);

            try
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();

                Reporting.Debug("Wait until Progress Indicator becomes not visible.");
                while (stopwatch.ElapsedMilliseconds < Common.DefaultValues.GeneralTimeout)
                {
                    if (!IsProgressIndicatorVisible())
                    {
                        Reporting.Debug("Progress Indicator is not visible.");
                        return(true);
                    }
                }

                Reporting.Error(string.Format("Progress Indicator is still visible after {0} miliseconds.", Common.DefaultValues.GeneralTimeout));
                return(false);
            }
            catch (Exception exception)
            {
                Reporting.Error(exception.Message);
                return(false);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// The run.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Run()
        {
            Logging.Enter(this, MethodBase.GetCurrentMethod().Name);

            try
            {
                var repo = DeviceCareApplication.Instance;
                if (repo.MenuArea.MainMenu.MainMenuItems.ButtonHomeInfo.Exists())
                {
                    Reporting.Debug("Close Project by pressing home button.");
                    repo.MenuArea.MainMenu.MainMenuItems.ButtonHome.Click();

                    repo.ApplicationArea.ConnectionSelection.ButtonConnectionAutomaticInfo.WaitForExists(Common.DefaultValues.GeneralTimeout);
                    if (repo.ApplicationArea.ConnectionSelection.ButtonConnectionAutomaticInfo.Exists())
                    {
                        Reporting.Debug("Project closed. ");
                        return(true);
                    }

                    Reporting.Error("Button Connect automatically is not available.");
                    return(false);
                }

                Reporting.Error("Button Home is not available");
                return(false);
            }
            catch (Exception exception)
            {
                Reporting.Error("Button Connect automatically did not become available.");
                Reporting.Error(exception.Message);
                return(false);
            }
        }
        /// <summary>
        /// The close dtm function.
        /// </summary>
        /// <param name="functionName">
        /// The function name.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool CloseDtmFunction(string functionName)
        {
            Logging.Enter(typeof(DtmFunctions), MethodBase.GetCurrentMethod().Name);

            bool result = true;

            if (!DeviceCareModuleFunctions.IsClosingElementAvailable())
            {
                Reporting.Debug("Cannot close module this way.");
                Reporting.Debug("Open and close another module to make close button available.");
                string helperFunctionName = ProgramFunctions.OpenShowProgress();
                if (helperFunctionName.Equals(string.Empty))
                {
                    result = false;
                }

                result &= AdditionalFunctions.CloseAdditionalFunction(helperFunctionName);
            }

            Reporting.Debug(string.Format("Select module {0}.", functionName));
            result &= SelectDtmFunctions(functionName);
            Reporting.Debug(string.Format("Close module {0}.", functionName));
            result &= CloseTabPage(functionName);
            return(result);
        }
        /// <summary>
        /// The open program functions.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool OpenMenu()
        {
            Logging.Enter(typeof(DtmFunctions), MethodBase.GetCurrentMethod().Name);

            DeviceCareApplication repo = DeviceCareApplication.Instance;
            MenuItem menuItem;

            bool result;

            Host.Local.TryFindSingle(repo.MenuArea.MainMenu.DTMFunctionsInfo.AbsolutePath, out menuItem);
            if (menuItem != null && menuItem.Visible)
            {
                menuItem.Click();
                Reporting.Debug("Menu item DTM Functions found and clicked.");

                if (Validation.DtmFunctions.IsMenuItemAvailable())
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            else
            {
                Reporting.Error("Could not access menu DTM Functions.");
                result = false;
            }

            return(result);
        }
Esempio n. 8
0
        /// <summary>
        /// The run.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Run()
        {
            Logging.Enter(this, MethodBase.GetCurrentMethod().Name);

            var deviceCareProcessFunctions = new DeviceCareProcessFunctions();

            Reporting.Debug("Open DeviceCare");
            return(deviceCareProcessFunctions.Run());
        }
        /// <summary>
        /// The run.
        /// </summary>
        /// <param name="parent">
        /// The parent.
        /// </param>
        /// <param name="device">
        /// The device.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Run(string parent, string device)
        {
            /*
             * Function not supported by DC
             * Method reports warning message and returns with false
             */

            Logging.Enter(this, MethodBase.GetCurrentMethod().Name);
            Reporting.Info("Function Add Device is not supported by Host Application: DeviceCare");
            return(false);
        }
Esempio n. 10
0
        /// <summary>
        /// The run.
        /// </summary>
        /// <param name="path">
        /// The path.
        /// </param>
        /// <param name="timeOutInMilliseconds">
        /// The time out in milliseconds.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Run(string path, int timeOutInMilliseconds)
        {
            Logging.Enter(this, MethodBase.GetCurrentMethod().Name);

            var deviceCareProcessFunctions = new DeviceCareProcessFunctions();

            Reporting.Debug("Open DeviceCare");
            int processId = deviceCareProcessFunctions.Run(path, timeOutInMilliseconds);

            return(HostApplication.IsHostApplicationOpen(processId));
        }
        /// <summary>
        /// The show progress.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static string OpenShowProgress()
        {
            Logging.Enter(typeof(ProgramFunctions), MethodBase.GetCurrentMethod().Name);

            DeviceCareApplication repo = DeviceCareApplication.Instance;

            if (RunAdditionalFunctions())
            {
                repo.MenuArea.MainMenu.ProgramFunctionsMenuItems.ShowProgressInfo.WaitForExists(Common.DefaultValues.GeneralTimeout);
                MenuItem showProgress;
                Host.Local.TryFindSingle(repo.MenuArea.MainMenu.ProgramFunctionsMenuItems.ShowProgressInfo.AbsolutePath, out showProgress);

                IList <TabPage> tabPagesBefore = Host.Local.Find <TabPage>(repo.ApplicationArea.ModuleSelection.ModuleTabPagesInfo.AbsolutePath);

                if (showProgress != null && showProgress.Visible)
                {
                    showProgress.Click();
                    Reporting.Debug("Menu item Show Progress found and clicked.");

                    IList <TabPage> tabPagesAfter = Host.Local.Find <TabPage>(repo.ApplicationArea.ModuleSelection.ModuleTabPagesInfo.AbsolutePath);
                    foreach (var tabPageAfter in tabPagesAfter)
                    {
                        Text textAfter = tabPageAfter.FindSingle("text");
                        if (textAfter != null)
                        {
                            string textValueAfter = textAfter.Element.GetAttributeValueText("caption");
                            if (textValueAfter != null)
                            {
                                foreach (var tabPageBefore in tabPagesBefore)
                                {
                                    Text textBefore = tabPageBefore.FindSingle("text");
                                    if (textBefore != null)
                                    {
                                        string textValueBefore = textBefore.Element.GetAttributeValueText("caption");
                                        if (textValueBefore != null)
                                        {
                                            if (!textValueBefore.Equals(textValueAfter))
                                            {
                                                Reporting.Debug(string.Format("Name of currently opened function is {0}", textValueAfter));
                                                return(textValueAfter);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            Reporting.Error("Could not access menu item Show Progress.");
            return(string.Empty);
        }
Esempio n. 12
0
        /// <summary>
        /// The is device connected.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool IsDeviceConnected()
        {
            Logging.Enter(typeof(Connection), MethodBase.GetCurrentMethod().Name);
            DeviceCareApplication repo = DeviceCareApplication.Instance;

            if (!repo.StatusArea.ConnectionIndicatorInfo.Exists())
            {
                Reporting.Debug("There is no device connected.");
                return(false);
            }

            Reporting.Debug("A device is connected.");
            return(true);
        }
Esempio n. 13
0
        /// <summary>
        /// The run.
        /// </summary>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public string Run()
        {
            Logging.Enter(typeof(GetDtmContainerPath), MethodBase.GetCurrentMethod().Name);

            try
            {
                return(new Functions.ApplicationArea.MainView.Execution.GetDtmContainerPath().Run());
            }
            catch (Exception exception)
            {
                Reporting.Error(exception.Message);
                return(null);
            }
        }
        /// <summary>
        /// The run.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public string Run()
        {
            Logging.Enter(typeof(GetHostApplicationLanguage), MethodBase.GetCurrentMethod().Name);
            Reporting.Debug("Getting DeviceCare language from application config file.");

            const string EnvironmentVariable = "APPDATA";
            string       path = Environment.GetEnvironmentVariable(EnvironmentVariable);

            path = path + "\\..\\Local\\Endress+Hauser\\DeviceCare SFE100\\Shared\\Application.config";
            string languageCulture = string.Empty;

            if (!string.IsNullOrEmpty(path))
            {
                XmlDocument applicationConfiguration = new XmlDocument();
                applicationConfiguration.Load(path);
                XmlNodeList nodes = applicationConfiguration.SelectNodes("/config/settings/culture/name");
                if (nodes != null)
                {
                    foreach (XmlNode node in nodes)
                    {
                        languageCulture = node.InnerText;
                    }
                }
            }

            switch (languageCulture)
            {
            case "en-US":
                return("English");

            case "fr-FR":
                return("French");

            case "de-DE":
                return("German");

            case "it-IT":
                return("Italian");

            case "es-ES":
                return("Spanish");

            default:
                Reporting.Error(string.Format("Language culture {0}  is not supported", languageCulture));
                return(string.Empty);
            }
        }
        /// <summary>
        /// The create by assistant.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool CloseEventLog()
        {
            Logging.Enter(typeof(EventLog), MethodBase.GetCurrentMethod().Name);

            DeviceCareApplication repo = DeviceCareApplication.Instance;

            if (!repo.Dialog.EventLog.CloseInfo.Exists())
            {
                Reporting.Error("Button Close is not available. Event Log cannot be closed.");
                return(false);
            }

            Reporting.Debug("Button Close is available.");
            Reporting.Debug("Close Event Log Dialog");
            repo.Dialog.EventLog.Close.Click();
            return(true);
        }
        /// <summary>
        /// The create automatically.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool OpenEventLog()
        {
            Logging.Enter(typeof(EventLog), MethodBase.GetCurrentMethod().Name);

            DeviceCareApplication repo = new DeviceCareApplication();

            if (!repo.StatusArea.StatusBarInfo.Exists())
            {
                Reporting.Error("Element Status Bar is not available. Event Log cannot be opened.");
                return(false);
            }

            Reporting.Debug("Status Bar is available.");
            Reporting.Debug("Open Event Log Dialog");
            repo.StatusArea.StatusBar.Click();
            return(true);
        }
Esempio n. 17
0
 /// <summary>
 /// The is menu item available.
 /// </summary>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public static bool IsMenuItemAvailable()
 {
     Logging.Enter(typeof(DtmFunctions), MethodBase.GetCurrentMethod().Name);
     try
     {
         DeviceCareApplication repo = DeviceCareApplication.Instance;
         repo.MenuArea.MainMenu.DTMFunctionMenuItems.OnlineParameterizationInfo.WaitForExists(Common.DefaultValues.GeneralTimeout);
         Reporting.Debug("Menu Items of menu DTM Function are available.");
         return(true);
     }
     catch (Exception exception)
     {
         Reporting.Error("Menu Items of menu DTM Function are not available.");
         Reporting.Error(exception.Message);
         return(false);
     }
 }
        /// <summary>
        /// The create automatically.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool IsEventLogClosed()
        {
            try
            {
                Logging.Enter(typeof(EventLog), MethodBase.GetCurrentMethod().Name);

                DeviceCareApplication repo = new DeviceCareApplication();
                repo.Dialog.EventLog.CloseInfo.WaitForNotExists(Common.DefaultValues.GeneralTimeout);
                Reporting.Debug("Event Log Dialog is not available.");
                return(true);
            }
            catch (Exception exception)
            {
                Reporting.Error("Event Log Dialog is still available.");
                Reporting.Error(exception.Message);
                return(false);
            }
        }
        /// <summary>
        /// The open program functions.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool OpenMenu()
        {
            Logging.Enter(typeof(ProgramFunctions), MethodBase.GetCurrentMethod().Name);

            DeviceCareApplication repo = DeviceCareApplication.Instance;
            MenuItem menuItem;

            Host.Local.TryFindSingle(repo.MenuArea.MainMenu.ProgramFunctionsInfo.AbsolutePath, out menuItem);
            if (menuItem != null && menuItem.Visible)
            {
                menuItem.Click();
                Reporting.Debug("Menu item Program Functions found and clicked.");
                return(true);
            }

            Reporting.Error("Could not access menu Program Functions.");
            return(false);
        }
        /// <summary>
        /// The open program functions.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool IsMenuAvailable()
        {
            Logging.Enter(typeof(DeviceReport), MethodBase.GetCurrentMethod().Name);

            DeviceCareApplication repo = DeviceCareApplication.Instance;

            repo.MenuArea.MainMenu.DeviceReportInfo.WaitForExists(Common.DefaultValues.GeneralTimeout);
            if (repo.MenuArea.MainMenu.DeviceReportInfo.Exists())
            {
                if (repo.MenuArea.MainMenu.DeviceReport != null && repo.MenuArea.MainMenu.DeviceReport.Visible)
                {
                    Reporting.Debug("Menu item Device Report is available.");
                    return(true);
                }
            }

            Reporting.Debug("Menu item Device Report is not available.");
            return(false);
        }
        /// <summary>
        /// The get all messages from event log.
        /// </summary>
        /// <returns>
        /// The <see cref="List{T}"/>.
        /// </returns>
        public static List <string> GetAllMessagesFromEventLog()
        {
            Logging.Enter(typeof(EventLog), MethodBase.GetCurrentMethod().Name);

            List <string>         messages = new List <string>();
            DeviceCareApplication repo     = new DeviceCareApplication();

            if (Validation.EventLog.IsEventLogTableAvailable())
            {
                IList <Ranorex.Row> rows = repo.Dialog.EventLog.Table.Rows;
                Reporting.Debug("Scan Event Log Table for messages");
                foreach (var row in rows)
                {
                    messages.Add(row.Cells[2].Text);
                }
            }

            return(messages);
        }
        /// <summary>
        /// The restore device data.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool RunRestoreDeviceData()
        {
            Logging.Enter(typeof(ProgramFunctions), MethodBase.GetCurrentMethod().Name);

            if (OpenMenu())
            {
                DeviceCareApplication repo = DeviceCareApplication.Instance;
                MenuItem menuItem;
                Host.Local.TryFindSingle(repo.MenuArea.MainMenu.ProgramFunctionsMenuItems.RestoreDeviceDataInfo.AbsolutePath, out menuItem);
                if (menuItem != null && menuItem.Visible)
                {
                    menuItem.MoveTo();
                    Reporting.Debug("Menu item Restore Device Data found and moved to.");
                    return(true);
                }
            }

            Reporting.Error("Could not access menu item Restore Device Data.");
            return(false);
        }
        /// <summary>
        /// The close tab page.
        /// </summary>
        /// <param name="functionName">
        /// The function name.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        private static bool CloseTabPage(string functionName)
        {
            Logging.Enter(typeof(DtmFunctions), MethodBase.GetCurrentMethod().Name);

            DeviceCareApplication repo = DeviceCareApplication.Instance;
            Button button;
            string path = repo.ApplicationArea.ModuleSelection.ModuleCloseButtonInfo.AbsolutePath.ToString();

            path = path.Replace("MODULENAME", functionName);
            RxPath ranorexPath = path;

            Host.Local.TryFindSingle(ranorexPath, out button);
            if (button != null)
            {
                button.Press();
                Reporting.Debug(string.Format("Module {0} close button found and pressed.", functionName));
                return(true);
            }

            Reporting.Error(string.Format("Could not access module {0} close button.", functionName));
            return(false);
        }
        /// <summary>
        /// The select dtm functions.
        /// </summary>
        /// <param name="functionName">
        /// The function name.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool SelectDtmFunctions(string functionName)
        {
            Logging.Enter(typeof(DtmFunctions), MethodBase.GetCurrentMethod().Name);

            DeviceCareApplication repo = DeviceCareApplication.Instance;
            TabPage tabPage;
            string  path = repo.ApplicationArea.ModuleSelection.ModuleTabPageInfo.AbsolutePath.ToString();

            path = path.Replace("MODULENAME", functionName);
            RxPath ranorexPath = path;

            Host.Local.TryFindSingle(ranorexPath, out tabPage);
            if (tabPage != null)
            {
                tabPage.Select();
                Reporting.Debug(string.Format("Module {0} found and selected.", functionName));
                return(true);
            }

            Reporting.Error(string.Format("Could not find module {0} to select.", functionName));
            return(false);
        }
        /// <summary>
        /// The restore device data browse.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool OpenRestoreDeviceDataBrowse()
        {
            Logging.Enter(typeof(ProgramFunctions), MethodBase.GetCurrentMethod().Name);

            // DeviceCareApplication repo = DeviceCareApplication.Instance;
            // if (RestoreDeviceData())
            // {
            //    repo.MenuArea.MainMenu.ProgramFunctionsMenuItems.RestoreBrowseInfo.WaitForExists(Common.DefaultValues.GeneralTimeout);
            //    MenuItem restoreDeviceDataBrowse;
            //    Host.Local.TryFindSingle(repo.MenuArea.MainMenu.ProgramFunctionsMenuItems.RestoreBrowseInfo.AbsolutePath, out restoreDeviceDataBrowse);
            //    if (restoreDeviceDataBrowse != null && restoreDeviceDataBrowse.Visible)
            //    {
            //        restoreDeviceDataBrowse.Click();
            //        Reporting.Error("Menu item Device Data Browse found and clicked.");
            //        return true;
            //    }
            // }

            // Reporting.Error("Could not access menu item Restore Device Data Browse.");
            Reporting.Error("Not Implemented Yet");
            return(false);
        }
Esempio n. 26
0
        /// <summary>
        /// The is online parameterize available.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool IsOnlineParameterizeAvailable()
        {
            Logging.Enter(typeof(DtmFunctions), MethodBase.GetCurrentMethod().Name);
            DeviceCareApplication repo = DeviceCareApplication.Instance;

            bool result = Execution.DtmFunctions.OpenMenu();

            if (result && repo.MenuArea.MainMenu.DTMFunctionMenuItems.OnlineParameterizationInfo.Exists())
            {
                if (repo.MenuArea.MainMenu.DTMFunctionMenuItems.OnlineParameterization.Enabled)
                {
                    Reporting.Debug("Menu item Online Parameterize is enabled.");
                    return(true);
                }

                Reporting.Debug("Menu item Online Parameterize is not enabled.");
                return(false);
            }

            Reporting.Error("Menu item Online Parameterize is not available.");
            return(false);
        }
        /// <summary>
        /// The run.
        /// </summary>
        /// <param name="word">
        /// The word.
        /// </param>
        /// <param name="number">
        /// The number.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Run(string word, int number)
        {
            Logging.Enter(this, MethodBase.GetCurrentMethod().Name);

            // check if device is connected
            if (Functions.StatusArea.StatusBar.Validation.Connection.IsDeviceConnected())
            {
                if (Functions.MenuArea.MenuBar.Execution.DeviceReport.SaveDeviceReport())
                {
                    bool methodResult = Functions.StatusArea.StatusBar.Validation.ProgressIndicator.WaitUntilProgressIndicatorBecomesAvailable();
                    methodResult &= Functions.StatusArea.StatusBar.Validation.ProgressIndicator.WaitUntilProgressIndicatorBecomesNotAvailable();

                    if (methodResult)
                    {
                        if (Functions.Dialogs.Execution.EventLog.OpenEventLog())
                        {
                            string lastMessage = Functions.Dialogs.Execution.EventLog.GetLastMessageFromEventLog();
                            Reporting.Debug(lastMessage);

                            if (Functions.Dialogs.Execution.EventLog.CloseEventLog())
                            {
                                return(true);
                            }

                            return(false);
                        }

                        return(false);
                    }

                    return(false);
                }

                return(false);
            }

            return(false);
        }
        /// <summary>
        /// The open dtm function.
        /// </summary>
        /// <param name="functionName">
        /// The function name.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool OpenDtmFunction(string functionName)
        {
            Logging.Enter(typeof(DtmFunctions), MethodBase.GetCurrentMethod().Name);

            if (OpenMenu())
            {
                DeviceCareApplication repo = DeviceCareApplication.Instance;
                Text   text;
                string path = repo.MenuArea.MainMenu.DTMFunctionMenuItems.MenuItemInfo.AbsolutePath.ToString();
                path = path.Replace("MODULENAME", functionName);
                RxPath ranorexPath = path;
                Host.Local.TryFindSingle(ranorexPath, Common.DefaultValues.GeneralTimeout, out text);
                if (text != null && text.Visible)
                {
                    text.Click();
                    Reporting.Debug(string.Format("Menu item {0} found and clicked.", functionName));
                    return(true);
                }
            }

            Reporting.Error(string.Format("Could not access menu item {0}.", functionName));
            return(false);
        }
Esempio n. 29
0
        /// <summary>
        /// The run.
        /// </summary>
        /// <param name="functionName">
        /// The function name.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Run(string functionName)
        {
            Logging.Enter(this, MethodBase.GetCurrentMethod().Name);

            try
            {
                Text text = Functions.ApplicationArea.MainView.Helpers.DeviceCareModuleFunctions.IsFunctionOpened(functionName);
                if (text != null && text.Visible)
                {
                    text.Click();
                    return(true);
                }

                Reporting.Error("Functions is not opened");
                return(false);
            }
            catch (Exception exception)
            {
                Reporting.Error(string.Format("Could not switch to function {0}", functionName));
                Reporting.Error(exception.Message);
                return(false);
            }
        }
        /// <summary>
        /// The is event log table available.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool IsEventLogTableAvailable()
        {
            try
            {
                Logging.Enter(typeof(EventLog), MethodBase.GetCurrentMethod().Name);

                DeviceCareApplication repo = new DeviceCareApplication();
                if (repo.Dialog.EventLog.TableInfo.Exists())
                {
                    Reporting.Debug("Event Log Table is available.");
                    return(true);
                }

                Reporting.Error("Event Log Table is not available.");
                return(false);
            }
            catch (Exception exception)
            {
                Reporting.Error("Event Log Table is not available.");
                Reporting.Error(exception.Message);
                return(false);
            }
        }