SBApplication Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
This class provides API to send Apple events to scriptable applications and get Apple events back.
[Foundation.Register("SBApplication", true)]
public class SBApplication : ScriptingBridge.SBObject, IDisposable
[<Foundation.Register("SBApplication", true)>]
type SBApplication = class
inherit SBObject
interface INSCoding
interface INativeObject
interface IDisposable
- Inheritance
- Attributes
- Implements
Remarks
There are multiple steps to use this API successfully.
First step is to create a binding project, which will define a protocol for the specific application to interact with, and the corresponding API. The code in the API definition for the binding project should look something like this:
namespace Finder {
[Protocol]
interface FinderApplication {
[Export ("version")]
string Version { get; }
}
}
The second step is to create an executable project, which references the binding project. Additionally, the executable project defines a class that mirrors the protocol from the binding project:
namespace Finder {
[Protocol]
class FinderApplication : SBApplication, IFinderApplication {
// This constructor so that the runtime can create an instance of this class from the
// Objetive-C object handle in the call to SBApplication.GetApplication.
protected FinderApplication (NativeHandle handle) { }
// Otherwise this class is empty, all the API will be provided through the protocol interface.
}
}
Note that the FinderApplication class subclasses this class (SBApplication), in addition to implementing the FinderApplication protocol (which has been generated as an interface, with an I prefix, in the binding project).
The final step is to call GetApplication, and cast the return value to the protocol interface.
public static string GetFinderVersion () {
var finder = (IFinderApplication) SBApplication.GetApplication<FinderApplication> ("com.apple.finder");
return finder.Version;
}
Constructors
| Name | Description |
|---|---|
| SBApplication(Int32) | |
| SBApplication(NativeHandle) |
A constructor used when creating managed representations of unmanaged objects. Called by the runtime. |
| SBApplication(NSCoder) |
A constructor that initializes the object from the data stored in the unarchiver object. |
| SBApplication(NSObjectFlag) |
Constructor to call on derived classes to skip initialization and merely allocate the object. |
| SBApplication(NSUrl) | |
| SBApplication(String) | |
Properties
| Name | Description |
|---|---|
| Class | (Inherited from NSObject) |
| ClassHandle |
The Objective-C class handle for this class. |
| DebugDescription | (Inherited from NSObject) |
| Delegate | |
| Description | (Inherited from NSObject) |
| EventFailed | |
| ExposedBindings | (Inherited from NSObject) |
| Get | (Inherited from SBObject) |
| Handle |
Handle (pointer) to the unmanaged object representation. (Inherited from NSObject) |
| IsDirectBinding | (Inherited from NSObject) |
| IsProxy | (Inherited from NSObject) |
| IsRunning | |
| LastError | (Inherited from SBObject) |
| LaunchFlags | |
| RetainCount | (Inherited from NSObject) |
| Self | (Inherited from NSObject) |
| SendMode | |
| Superclass | (Inherited from NSObject) |
| SuperHandle |
Handle used to represent the methods in the base class for this NSObject. (Inherited from NSObject) |
| Timeout | |
| WeakDelegate | |
| Zone | (Inherited from NSObject) |