/// <summary>
 /// Determines whether the the specified element contains accessible state (Must not be right!!).
 /// </summary>
 /// <param name="obj">The element to test.</param>
 /// <param name="state">The AccessibleStateType to test for.</param>
 /// <returns>
 /// 	<c>true</c> if [contains accessible state]; otherwise, <c>false</c>.
 /// </returns>
 public static bool ContainsAccessibleState(XAccessible obj, AccessibleStateType state)
 {
     if (obj != null)
     {
         XAccessibleContext context = obj.getAccessibleContext();
         if (context != null)
         {
             var states = context.getAccessibleStateSet();
             if (states != null)
             {
                 return states.contains((short)state); ;
             }
         }
     }
     return false;
 }
 /// <summary>
 /// Determines whether [has accessible state] [the specified obj].
 /// </summary>
 /// <param name="obj">The obj.</param>
 /// <param name="state">The state.</param>
 /// <returns>
 /// 	<c>true</c> if [has accessible state] [the specified obj]; otherwise, <c>false</c>.
 /// </returns>
 public static bool HasAccessibleState(XAccessible obj, AccessibleStateType state)
 {
     if (obj != null)
     {
         try
         {
             XAccessibleContext context = obj.getAccessibleContext();
             if (context != null)
             {
                 var states = context.getAccessibleStateSet();
                 if (states != null)
                 {
                     bool contains = states.contains((short)state);
                     if (contains)
                     {
                         short[] stateArray = states.getStates();
                         bool exists = Array.Exists(stateArray,
                                         delegate(short s) { return s.Equals((short)state); }
                                     );
                         contains = exists;
                     }
                     return contains;
                 }
             }
         }
         catch (DisposedException) { }
     }
     return false;
 }