当前位置: 首页>>代码示例>>C#>>正文


C# Condition.GetType方法代码示例

本文整理汇总了C#中Condition.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Condition.GetType方法的具体用法?C# Condition.GetType怎么用?C# Condition.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Condition的用法示例。


在下文中一共展示了Condition.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsMeetsRequirements

        /// <summary>
        ///     Check to see if the specified automation element meets the requirements of the specified condition.
        /// </summary>
        /// <param name="condition">The condition to check.</param>
        /// <param name="element">The automation element to check.</param>
        /// <returns>True if the automation element meets the condition's requirements. False otherwise.</returns>
        public static bool IsMeetsRequirements(Condition condition, AutomationElement element)
        {
            var type = condition.GetType();
            if (condition == Condition.TrueCondition)
                // Always return true.
                return true;
            if (condition == Condition.FalseCondition)
                // Always returns false.
                return false;
            if (type == typeof(NotCondition))
                // Return the negation of the inner condition.
                return !IsMeetsRequirements(((NotCondition) condition).Condition, element);
            if (type == typeof(OrCondition))
                // Return true if any of the inner conditions are true.
                return ((OrCondition) condition).GetConditions().Any(inner => IsMeetsRequirements(inner, element));
            if (type == typeof(AndCondition))
                // Return true if all of the inner conditions are true.
                return ((AndCondition) condition).GetConditions().All(inner => IsMeetsRequirements(inner, element));
            if (type == typeof(StringPropertyCondition))
                // Return true if the string property condition matches.
                return ((StringPropertyCondition) condition).IsMatch(element);
            if (type == typeof(PropertyCondition)) {
                // Return true if the property condition matches.
                var propertyCondition = (PropertyCondition) condition;
                var actual = element.GetCurrentPropertyValue(propertyCondition.Property);
                var expected = propertyCondition.Value;

                Trace.WriteLine("Checking '" + AutomationPropertyHelper.ToString(actual) + "'='" + AutomationPropertyHelper.ToString(expected) + "'", "UIAutomation-ConditionHelper");
                return AutomationPropertyHelper.Equals(actual, expected);
            }
            // Don't know how to match any other conditions.
            throw new NotSupportedException("Condition '" + type + "' is not supported");
        }
开发者ID:vijayakumarsuraj,项目名称:UIAutomation,代码行数:39,代码来源:ConditionHelper.cs

示例2: FillConditionRow

 private void FillConditionRow(DataGridViewRow row, Condition condition)
 {
     row.Tag = condition;
     foreach (DataGridViewColumn col in dgConditions.Columns)
     {
         foreach (PropertyInfo info in condition.GetType().GetProperties(FLAG))
         {
             if (info.Name == col.Name)
                 row.Cells[col.Name].Value = info.GetValue(condition, null).ToString();
         }
     }
 }
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:12,代码来源:DeleteServiceEditor.cs

示例3: ToString

 /// <summary>
 ///     Gets the string representation of the specified condition.
 /// </summary>
 /// <param name="condition">The condition.</param>
 /// <returns>The string representation.</returns>
 public static string ToString(Condition condition)
 {
     var type = condition.GetType();
     if (condition == Condition.TrueCondition)
         return "TRUE";
     if (condition == Condition.FalseCondition)
         return "FALSE";
     if (type == typeof(NotCondition))
         return "NOT " + ToString(((NotCondition) condition).Condition);
     if (type == typeof(OrCondition))
         return string.Join(" OR ", ((OrCondition) condition).GetConditions().Select(ToString).ToList());
     if (type == typeof(AndCondition))
         return string.Join(" AND ", ((AndCondition) condition).GetConditions().Select(ToString).ToList());
     if (type == typeof(StringPropertyCondition))
         return ToString((StringPropertyCondition) condition);
     if (type == typeof(PropertyCondition))
         return ToString((PropertyCondition) condition);
     // Don't know how to print any other conditions.
     throw new NotSupportedException("Condition '" + type + "' not supported");
 }
开发者ID:vijayakumarsuraj,项目名称:UIAutomation,代码行数:25,代码来源:ConditionHelper.cs

示例4: traiteCondition

        private void traiteCondition(Condition conditionAEvaluer)
        {
            String expressionAEvaluer = conditionAEvaluer.obtenirChaineAEvaluer();
            this.remplaceValeurDesVariables(ref expressionAEvaluer);


            try
            {
                bool resultatExpression = (bool)new Expression(expressionAEvaluer).Evaluate();
                if (!resultatExpression)
                {
                    if (conditionAEvaluer.GetType() == typeof(TantQue))
                    {
                        this.parcourirJusquauProchainFinTantQue();
                    }
                    else if (conditionAEvaluer.GetType() == typeof(Si))
                    {
                        this.parcourirJusquauProchainFinSi(true);
                    }
                }
            }
            catch (Exception e)
            {
                this.expressionAEvaluerInvalide();
            }


        }
开发者ID:chamboug,项目名称:Projet_2A_Bee,代码行数:28,代码来源:Algorithme.cs


注:本文中的Condition.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。