Пример #1
0
        internal static string BuildErrorMessage(Use use, bool useTimeout, bool useInterval, uint intervalTime, TimeSpan timeout, Is @is)
        {
            var builder = new StringBuilder();

            builder.AppendLine("The window could not be found.");
            builder.AppendLine();
            builder.AppendLine("Condition(s):");
            builder.AppendLine(use.GetConditionDescription());
            builder.AppendLine();
            builder.AppendLine("Settings:");
            if (useTimeout)
            {
                builder.AppendLine("* With timeout: " + timeout);
            }
            else
            {
                builder.AppendLine("* Without timeout");
            }
            if (useInterval)
            {
                builder.AppendLine("* With interval: " + intervalTime);
            }
            else
            {
                builder.AppendLine("* Without interval");
            }
            switch (@is.GetCondition())
            {
            case IsCondition.ChildOf:
                builder.AppendLine("* Is child of another window");
                break;

            case IsCondition.MainWindow:
                builder.AppendLine("* Is main window");
                break;

            case IsCondition.Nothing:
                break;

            case IsCondition.OwnerOf:
                builder.AppendLine("* Is owner of an element");
                break;

            case IsCondition.ParentOf:
                builder.AppendLine("* Is parent of another window");
                break;
            }
            builder.AppendLine();
            return(builder.ToString());
        }
Пример #2
0
        internal static string BuildMessage(Use use, bool useTimeout, bool useInterval, uint intervalTime, uint timeout, Is @is)
        {
            var builder = new StringBuilder();

            builder.AppendLine("Condition(s):");
            builder.AppendLine(use.GetConditionDescription());
            builder.Append("Settings:");
            if (useTimeout)
            {
                builder.Append(string.Format(" With timeout: {0}; ", timeout));
            }
            else
            {
                builder.Append(" Without timeout; ");
            }
            if (useInterval)
            {
                builder.Append(string.Format(" With interval: {0}", intervalTime));
            }
            else
            {
                builder.Append(" Without interval");
            }
            switch (@is.GetCondition())
            {
            case IsCondition.ChildOf:
                builder.Append("; Is child of another window.");
                break;

            case IsCondition.MainWindow:
                builder.Append("; Is main window.");
                break;

            case IsCondition.Nothing:
                builder.Append(".");
                break;

            case IsCondition.OwnerOf:
                builder.Append("; Is owner of an element.");
                break;

            case IsCondition.ParentOf:
                builder.Append("; Is parent of another window.");
                break;
            }
            return(builder.ToString());
        }