Exemple #1
0
        public static string GetStateBitText(AccessibilityState state)
        {
            var sb     = new StringBuilder(1024);
            var length = Oleacc.GetStateText(state, sb, 1024);

            return(sb.ToString());
        }
Exemple #2
0
 public void EmitAccessibilityStateChangedEvent(AccessibilityState e, bool b)
 {
     Interop.ControlDevel.DaliAccessibilityEmitAccessibilityStateChangedEvent(SwigCPtr, Convert.ToInt32(e), Convert.ToInt32(b));
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #3
0
 public void Set(AccessibilityState type, bool v)
 {
     Interop.ControlDevel.DaliToolkitDevelControlStatesSet(this, (int)type, Convert.ToInt32(v));
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #4
0
        public bool Get(AccessibilityState type)
        {
            bool result = Interop.ControlDevel.DaliToolkitDevelControlStatesGet(this, (int)type);

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(result);
        }
    private bool IsElementVisible(AutomationElement elem)
    {
        try
        {
            AccessibilityState state = elem.Patterns.LegacyIAccessible.Pattern.State.Value;
            if (state.HasFlag(AccessibilityState.STATE_SYSTEM_INVISIBLE))
            {
                return(false);
            }

            return(true);
        }
        catch {}

        return(false);
    }
Exemple #6
0
 public bool this[AccessibilityState state]
 {
     get
     {
         return(Convert.ToBoolean(BitMask & (1UL << (int)state)));
     }
     set
     {
         if (value)
         {
             // Set N-th bit
             BitMask |= (1UL << (int)state);
         }
         else
         {
             // Clear N-th bit
             BitMask &= ~(1UL << (int)state);
         }
     }
 }
    private AutomationElement GetSelectedItem(AutomationElement current, DesktopManager desktop)
    {
        Thread.Sleep(136);

        AutomationElement[] items = GetListItemElements(desktop);
        foreach (AutomationElement item in items)
        {
            try
            {
                AccessibilityState state = item.Patterns.LegacyIAccessible.Pattern.State.Value;
                if (state.HasFlag(AccessibilityState.STATE_SYSTEM_SELECTED))
                {
                    if (item.Equals(current))
                    {
                        return(null);
                    }
                    return(item);
                }
            }
            catch { }
        }
        return(null);
    }
Exemple #8
0
 public static extern uint GetStateText(AccessibilityState dwStateBit, [Out] StringBuilder lpszStateBit, uint cchStateBitMax);
Exemple #9
0
        public static string GetStateText(AccessibilityState state)
        {
            var allStates = state.GetFlags();

            return(String.Join(", ", allStates.Select(s => GetStateBitText((AccessibilityState)s)).ToArray()));
        }
        /// <summary>
        /// Gets a delegated offer.  (see
        /// http://msdn.microsoft.com/en-us/library/windowsazure/XXXXX.aspx
        /// for more information)
        /// </summary>
        /// <param name='offerName'>
        /// Required. the name of the delegated offer.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// Delegated offer get result.
        /// </returns>
        public async Task <DelegatedOfferGetResult> GetAsync(string offerName, CancellationToken cancellationToken)
        {
            // Validate
            if (offerName == null)
            {
                throw new ArgumentNullException("offerName");
            }

            // Tracing
            bool   shouldTrace  = TracingAdapter.IsEnabled;
            string invocationId = null;

            if (shouldTrace)
            {
                invocationId = TracingAdapter.NextInvocationId.ToString();
                Dictionary <string, object> tracingParameters = new Dictionary <string, object>();
                tracingParameters.Add("offerName", offerName);
                TracingAdapter.Enter(invocationId, this, "GetAsync", tracingParameters);
            }

            // Construct URL
            string url = "";

            url = url + "/subscriptions/";
            if (this.Client.Credentials.SubscriptionId != null)
            {
                url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
            }
            url = url + "/providers/Microsoft.Subscriptions/delegatedoffers/";
            url = url + Uri.EscapeDataString(offerName);
            List <string> queryParameters = new List <string>();

            queryParameters.Add("api-version=" + Uri.EscapeDataString(this.Client.ApiVersion));
            if (queryParameters.Count > 0)
            {
                url = url + "?" + string.Join("&", queryParameters);
            }
            string baseUrl = this.Client.BaseUri.AbsoluteUri;

            // Trim '/' character from the end of baseUrl and beginning of url.
            if (baseUrl[baseUrl.Length - 1] == '/')
            {
                baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
            }
            if (url[0] == '/')
            {
                url = url.Substring(1);
            }
            url = baseUrl + "/" + url;
            url = url.Replace(" ", "%20");

            // Create HTTP transport objects
            HttpRequestMessage httpRequest = null;

            try
            {
                httpRequest            = new HttpRequestMessage();
                httpRequest.Method     = HttpMethod.Get;
                httpRequest.RequestUri = new Uri(url);

                // Set Headers

                // Set Credentials
                cancellationToken.ThrowIfCancellationRequested();
                await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);

                // Send Request
                HttpResponseMessage httpResponse = null;
                try
                {
                    if (shouldTrace)
                    {
                        TracingAdapter.SendRequest(invocationId, httpRequest);
                    }
                    cancellationToken.ThrowIfCancellationRequested();
                    httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);

                    if (shouldTrace)
                    {
                        TracingAdapter.ReceiveResponse(invocationId, httpResponse);
                    }
                    HttpStatusCode statusCode = httpResponse.StatusCode;
                    if (statusCode != HttpStatusCode.OK)
                    {
                        cancellationToken.ThrowIfCancellationRequested();
                        CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
                        if (shouldTrace)
                        {
                            TracingAdapter.Error(invocationId, ex);
                        }
                        throw ex;
                    }

                    // Create Result
                    DelegatedOfferGetResult result = null;
                    // Deserialize Response
                    if (statusCode == HttpStatusCode.OK)
                    {
                        cancellationToken.ThrowIfCancellationRequested();
                        string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

                        result = new DelegatedOfferGetResult();
                        JToken responseDoc = null;
                        if (string.IsNullOrEmpty(responseContent) == false)
                        {
                            responseDoc = JToken.Parse(responseContent);
                        }

                        if (responseDoc != null && responseDoc.Type != JTokenType.Null)
                        {
                            DelegatedOfferModel delegatedOfferInstance = new DelegatedOfferModel();
                            result.DelegatedOffer = delegatedOfferInstance;

                            JToken offerNameValue = responseDoc["offerName"];
                            if (offerNameValue != null && offerNameValue.Type != JTokenType.Null)
                            {
                                string offerNameInstance = ((string)offerNameValue);
                                delegatedOfferInstance.OfferName = offerNameInstance;
                            }

                            JToken externalReferenceIdValue = responseDoc["externalReferenceId"];
                            if (externalReferenceIdValue != null && externalReferenceIdValue.Type != JTokenType.Null)
                            {
                                string externalReferenceIdInstance = ((string)externalReferenceIdValue);
                                delegatedOfferInstance.ExternalReferenceId = externalReferenceIdInstance;
                            }

                            JToken accessibilityStateValue = responseDoc["accessibilityState"];
                            if (accessibilityStateValue != null && accessibilityStateValue.Type != JTokenType.Null)
                            {
                                AccessibilityState accessibilityStateInstance = ((AccessibilityState)Enum.Parse(typeof(AccessibilityState), ((string)accessibilityStateValue), true));
                                delegatedOfferInstance.AccessibilityState = accessibilityStateInstance;
                            }

                            JToken decommissionedByParentProviderValue = responseDoc["decommissionedByParentProvider"];
                            if (decommissionedByParentProviderValue != null && decommissionedByParentProviderValue.Type != JTokenType.Null)
                            {
                                bool decommissionedByParentProviderInstance = ((bool)decommissionedByParentProviderValue);
                                delegatedOfferInstance.DecommissionedByParentProvider = decommissionedByParentProviderInstance;
                            }
                        }
                    }
                    result.StatusCode = statusCode;

                    if (shouldTrace)
                    {
                        TracingAdapter.Exit(invocationId, result);
                    }
                    return(result);
                }
                finally
                {
                    if (httpResponse != null)
                    {
                        httpResponse.Dispose();
                    }
                }
            }
            finally
            {
                if (httpRequest != null)
                {
                    httpRequest.Dispose();
                }
            }
        }
        /// <summary>
        /// Next for get delegated offers for given subscription ID.  (see
        /// http://msdn.microsoft.com/en-us/library/windowsazure/XXXXX.aspx
        /// for more information)
        /// </summary>
        /// <param name='nextLink'>
        /// Required. The next link.  (see
        /// http://msdn.microsoft.com/en-us/library/windowsazure/XXXXX.aspx
        /// for more information)
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// Your documentation here.
        /// </returns>
        public async Task <DelegatedOfferListResult> ListNextAsync(string nextLink, CancellationToken cancellationToken)
        {
            // Validate
            if (nextLink == null)
            {
                throw new ArgumentNullException("nextLink");
            }

            // Tracing
            bool   shouldTrace  = TracingAdapter.IsEnabled;
            string invocationId = null;

            if (shouldTrace)
            {
                invocationId = TracingAdapter.NextInvocationId.ToString();
                Dictionary <string, object> tracingParameters = new Dictionary <string, object>();
                tracingParameters.Add("nextLink", nextLink);
                TracingAdapter.Enter(invocationId, this, "ListNextAsync", tracingParameters);
            }

            // Construct URL
            string url = "";

            url = url + Uri.EscapeDataString(nextLink);
            url = url.Replace(" ", "%20");

            // Create HTTP transport objects
            HttpRequestMessage httpRequest = null;

            try
            {
                httpRequest            = new HttpRequestMessage();
                httpRequest.Method     = HttpMethod.Get;
                httpRequest.RequestUri = new Uri(url);

                // Set Headers

                // Set Credentials
                cancellationToken.ThrowIfCancellationRequested();
                await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);

                // Send Request
                HttpResponseMessage httpResponse = null;
                try
                {
                    if (shouldTrace)
                    {
                        TracingAdapter.SendRequest(invocationId, httpRequest);
                    }
                    cancellationToken.ThrowIfCancellationRequested();
                    httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);

                    if (shouldTrace)
                    {
                        TracingAdapter.ReceiveResponse(invocationId, httpResponse);
                    }
                    HttpStatusCode statusCode = httpResponse.StatusCode;
                    if (statusCode != HttpStatusCode.OK)
                    {
                        cancellationToken.ThrowIfCancellationRequested();
                        CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
                        if (shouldTrace)
                        {
                            TracingAdapter.Error(invocationId, ex);
                        }
                        throw ex;
                    }

                    // Create Result
                    DelegatedOfferListResult result = null;
                    // Deserialize Response
                    if (statusCode == HttpStatusCode.OK)
                    {
                        cancellationToken.ThrowIfCancellationRequested();
                        string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

                        result = new DelegatedOfferListResult();
                        JToken responseDoc = null;
                        if (string.IsNullOrEmpty(responseContent) == false)
                        {
                            responseDoc = JToken.Parse(responseContent);
                        }

                        if (responseDoc != null && responseDoc.Type != JTokenType.Null)
                        {
                            JToken valueArray = responseDoc["value"];
                            if (valueArray != null && valueArray.Type != JTokenType.Null)
                            {
                                foreach (JToken valueValue in ((JArray)valueArray))
                                {
                                    DelegatedOfferModel delegatedOfferModelInstance = new DelegatedOfferModel();
                                    result.DelegatedOffers.Add(delegatedOfferModelInstance);

                                    JToken offerNameValue = valueValue["offerName"];
                                    if (offerNameValue != null && offerNameValue.Type != JTokenType.Null)
                                    {
                                        string offerNameInstance = ((string)offerNameValue);
                                        delegatedOfferModelInstance.OfferName = offerNameInstance;
                                    }

                                    JToken externalReferenceIdValue = valueValue["externalReferenceId"];
                                    if (externalReferenceIdValue != null && externalReferenceIdValue.Type != JTokenType.Null)
                                    {
                                        string externalReferenceIdInstance = ((string)externalReferenceIdValue);
                                        delegatedOfferModelInstance.ExternalReferenceId = externalReferenceIdInstance;
                                    }

                                    JToken accessibilityStateValue = valueValue["accessibilityState"];
                                    if (accessibilityStateValue != null && accessibilityStateValue.Type != JTokenType.Null)
                                    {
                                        AccessibilityState accessibilityStateInstance = ((AccessibilityState)Enum.Parse(typeof(AccessibilityState), ((string)accessibilityStateValue), true));
                                        delegatedOfferModelInstance.AccessibilityState = accessibilityStateInstance;
                                    }

                                    JToken decommissionedByParentProviderValue = valueValue["decommissionedByParentProvider"];
                                    if (decommissionedByParentProviderValue != null && decommissionedByParentProviderValue.Type != JTokenType.Null)
                                    {
                                        bool decommissionedByParentProviderInstance = ((bool)decommissionedByParentProviderValue);
                                        delegatedOfferModelInstance.DecommissionedByParentProvider = decommissionedByParentProviderInstance;
                                    }
                                }
                            }

                            JToken odatanextLinkValue = responseDoc["@odata.nextLink"];
                            if (odatanextLinkValue != null && odatanextLinkValue.Type != JTokenType.Null)
                            {
                                string odatanextLinkInstance = ((string)odatanextLinkValue);
                                result.NextLink = odatanextLinkInstance;
                            }
                        }
                    }
                    result.StatusCode = statusCode;

                    if (shouldTrace)
                    {
                        TracingAdapter.Exit(invocationId, result);
                    }
                    return(result);
                }
                finally
                {
                    if (httpResponse != null)
                    {
                        httpResponse.Dispose();
                    }
                }
            }
            finally
            {
                if (httpRequest != null)
                {
                    httpRequest.Dispose();
                }
            }
        }