Exemplo n.º 1
0
 public override string this[string propertyName]
 {
     get
     {
         if (CommonProperties.Contains(propertyName))
         {
             return(base[propertyName]);
         }
         return(null);
     }
 }
Exemplo n.º 2
0
 public override string this[string propertyName]
 {
     get
     {
         try
         {
             if (CommonProperties.Contains(propertyName))
             {
                 return(base[propertyName]);
             }
             if (propertyName == SupportedPatternsName)
             {
                 return(SupportedPatterns);
             }
             if (CommonProperties.Contains(propertyName))
             {
                 return(base[propertyName]);
             }
             if (propertyName.Equals("AutomationId"))
             {
                 return(Current.Current.AutomationId);
             }
             if (propertyName.Equals("Name"))
             {
                 return(Current.Current.Name);
             }
             if (propertyName.Equals("ProcessId"))
             {
                 return(Current.Current.ProcessId.ToString());
             }
             if (propertyName.Equals("ClassName"))
             {
                 return(Current.Current.ClassName);
             }
             if (propertyName.Equals("ControlType"))
             {
                 string controlType = Current.Current.ControlType.ProgrammaticName;
                 int    dotPos      = controlType.IndexOf('.');
                 return(controlType.Substring(dotPos + 1));
             }
             if (propertyName.Equals("FrameworkId"))
             {
                 return(Current.Current.FrameworkId);
             }
             if (propertyName.Equals("IsContentElement"))
             {
                 return(Current.Current.IsContentElement.ToString());
             }
             if (propertyName.Equals("IsControlElement"))
             {
                 return(Current.Current.IsControlElement.ToString());
             }
             if (propertyName.Equals("IsPassword"))
             {
                 return(Current.Current.IsPassword.ToString());
             }
             if (propertyName.Equals("LocalizedControlType"))
             {
                 return(Current.Current.LocalizedControlType);
             }
             throw new ArgumentException();
         }
         catch
         {
             return(null);
         }
     }
 }