Export (0) Print
Expand All

AutomationFactory.IsAvailable Property

Silverlight

Gets a value that indicates whether the Automation feature in Silverlight is available to the application.

Namespace:  System.Runtime.InteropServices.Automation
Assembly:  System.Windows (in System.Windows.dll)

public static bool IsAvailable { get; }

Property Value

Type: System.Boolean
true if the Automation feature in Silverlight is available to the application; otherwise, false.

You should always check this property before using the AutomationFactory class to access an Automation server.

For more information about Automation, see Automation.

The following code example demonstrates how to use this property.

This example is part of a larger example in How to: Use Automation in Trusted Applications.


public MainPage()
{
    InitializeComponent();
    if (AutomationFactory.IsAvailable)
    {
        // Use Outlook on a background thread to keep the UI responsive.
        BackgroundWorker worker = new BackgroundWorker();
        worker.DoWork += (sender, e) =>
        {
            if (InitializeOutlook()) SearchEmail();
            else Dispatcher.BeginInvoke(() =>
            {
                MessageBox.Show("Outlook is not available.");
            });
        };
        worker.RunWorkerAsync();
    }
    else
    {
        MessageBox.Show("Automation is not available.");
    }
}


Silverlight

Supported in: 5, 4

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft