/// <summary> /// Initialize the agent with a specified URL. The InitializationComplete Action delegate must be set before calling this function. /// </summary> /// <param name="manifestUri">The URI if the manifest</param> public static void Initialize(Uri manifestUri) { if (InitializationComplete == null) { throw new OpenFinInitializationException("InitializationComplete action delegate must be set before calling Initialize."); } var runtimeOptions = RuntimeOptions.LoadManifest(manifestUri); runtimeInstance = Runtime.GetRuntimeInstance(runtimeOptions); runtimeInstance.Options.RuntimeConnectTimeout = -1; runtimeInstance.Connect(() => { var fdcService = runtimeInstance.CreateApplication(runtimeOptions.StartupApplicationOptions); fdcService.isRunning(ack => { if (!ack.HasAcked()) { fdcService.run(); } Connection.ConnectionInitializationComplete = exception => { InitializationComplete?.Invoke(exception); isInitialized = true; }; Connection.Initialize(runtimeInstance); }); }); }
/// <summary> /// Initialize the agent with a specified URL. The OnInitialized Action delegate must be set before calling this function. /// </summary> /// <param name="manifestUri">The URI of the path of the manifest.</param> public static void Initialize(string filePath) { if (isInitialized) { return; } if (OnInitialized == null) { throw new OpenFinInitializationException("OnInitialized action delegate must be set before calling Initialize."); } var runtimeOptions = RuntimeOptions.LoadManifest(filePath); completeInitialization(runtimeOptions); }
/// <summary> /// Initialize client with the default manifest URL /// </summary> public static void Initialize() { if (isInitialized) { return; } if (OnInitialized == null) { throw new OpenFinInitializationException("OnInitialized action delegate must be set before calling Initialize."); } var fdcManifestUri = new Uri(Fdc3ServiceConstants.ServiceManifestUrl); var runtimeOptions = RuntimeOptions.LoadManifest(fdcManifestUri); completeInitialization(runtimeOptions); }
public OpenFinIntegration() { _webAppOptions = RuntimeOptions.LoadManifest(new Uri(WebAppManifest)); DotNetOptions = new RuntimeOptions() { UUID = DotNetUuid, Version = _webAppOptions.Version, RemoteDevToolsPort = _webAppOptions.RemoteDevToolsPort }; DotNetOptions.UUID = DotNetUuid; _runtime = Runtime.GetRuntimeInstance(DotNetOptions); _openfinApp = _runtime.WrapApplication(_webAppOptions.StartupApplicationOptions.UUID); _runtime.Disconnected += Runtime_Disconnected; _openfinApp.Closed += DeepThoughtApp_Closed; }
/// <summary> /// Initializes the Notification Service. /// </summary> /// <param name="manifestUri">The Uri pointing to the notification service manifest.</param> public static void Initialize(Uri manifestUri) { if (OnInitComplete == null) { throw new InvalidOperationException("InitializationComplete handler must be registered before calling Initialize()"); } var runtimeOptions = RuntimeOptions.LoadManifest(manifestUri); runtimeOptions.Arguments += " --inspect"; var entryAssembly = System.Reflection.Assembly.GetEntryAssembly(); if (entryAssembly != null) { var productAttributes = entryAssembly.GetCustomAttributes(typeof(System.Reflection.AssemblyProductAttribute), true); if (productAttributes.Length > 0) { runtimeOptions.UUID = ((System.Reflection.AssemblyProductAttribute)productAttributes[0]).Product; } else { runtimeOptions.UUID = System.Reflection.Assembly.GetEntryAssembly().GetName().Name; } } else { runtimeOptions.UUID = Guid.NewGuid().ToString(); } _runtime = Runtime.GetRuntimeInstance(runtimeOptions); _runtime.Connect(() => { var notificationsService = _runtime.CreateApplication(runtimeOptions.StartupApplicationOptions); notificationsService.isRunning( async ack => { if (!(bool)(ack.getData() as JValue).Value) { notificationsService.run(); } _channelClient = _runtime.InterApplicationBus.Channel.CreateClient(ServiceConstants.NotificationServiceChannelName); _channelClient.RegisterTopic <NotificationEvent>(ChannelTopics.Events, (@event) => { switch (@event.EventType) { case NotificationEventTypes.NotificationAction: NotificationActionOccurred?.Invoke(@event); break; case NotificationEventTypes.NotificationClosed: NotificationClosed?.Invoke(@event); break; case NotificationEventTypes.NotificationCreated: NotificationCreated?.Invoke(@event); break; default: throw new ArgumentException($"Invalid event type : {@event.EventType}"); } }); await _channelClient.ConnectAsync(); await _channelClient.DispatchAsync(ApiTopics.AddEventListener, NotificationEventTypes.NotificationAction); OnInitComplete.Invoke(); }); }); }