public void _SetUp() { var ctx = TestProvider.GetSqlContext(); this.Repositories = TestProvider.GetRepositoryHub(ctx); this.Services = TestProvider.GetServiceHub(this.Repositories); }
public override int Handle(StartOptions command) { var virgilHub = ServiceHub.Create(ServiceHubConfig.UseAccessToken(ApiConfig.VirgilToken)); ServiceLocator.Setup(virgilHub); var eventAggregator = this.bootstrapper.Container.Resolve <IEventAggregator>(); eventAggregator.Subscribe(new Listener()); var appState = this.bootstrapper.Container.Resolve <ApplicationState>(); appState.Restore(); if (!appState.HasAccount) { Console.WriteLine(" There is no Virgil Card stored"); return(1); } var folderSettings = this.bootstrapper.Container.Resolve <FolderSettingsStorage>(); if (folderSettings.FolderSettings.IsEmpty()) { Console.WriteLine(" There is no folder to bropbox link configured"); return(1); } var validationErrors = folderSettings.FolderSettings.Validate(); if (validationErrors.Any()) { foreach (var validationError in validationErrors) { Console.WriteLine(" " + validationError); } return(1); } ExceptionNotifier.Current.OnDropboxSessionExpired(() => { eventAggregator.Publish(new DropboxSessionExpired()); Console.WriteLine(" Dropbox session has expired"); Environment.Exit(1); }); var folderLinkFacade = this.bootstrapper.Container.Resolve <FolderLinkFacade>(); Task.Factory.StartNew(() => folderLinkFacade.Rebuild()); Console.WriteLine(" Virgil sync is running"); while (true) { Console.ReadLine(); } }
public void Uninstall() { AxisPluginService.Ins.Dispose(); //释放数据工厂 AxisData.Factory.Release(); //取消服务注册 _services.ForEach(t => ServiceHub.Unregister(t.Id)); _services.Clear(); }
/// <summary> /// Setups the instance of <see cref="SimpleChat"/> and runs the message loop. /// </summary> public static async Task Launch() { serviceHub = ServiceHub.Create(Constants.VirgilSimpleChatAccessToken); var emailAddress = Param <string> .Mandatory("Enter Email Address").WaitInput(); var chatMember = await Authorize(emailAddress); var messagingClient = new IPMessagingClient(chatMember.Identity); var simpleChat = new SimpleChat(messagingClient, chatMember); Console.WriteLine("\nWelcome to DARKSIDE chat. Feel free to post here your DARK thoughts.\n"); await simpleChat.StartMessaging(); }
public void TestRelationQuery() { ParseObject parent = new ServiceHub { }.CreateObjectWithoutData("Foo", "abcxyz"); ParseRelation <ParseObject> relation = parent.GetRelation <ParseObject>("child"); ParseQuery <ParseObject> query = relation.Query; // Client side, the query will appear to be for the wrong class. // When the server recieves it, the class name will be redirected using the 'redirectClassNameForKey' option. Assert.AreEqual("Foo", query.GetClassName()); IDictionary <string, object> encoded = query.BuildParameters(); Assert.AreEqual("child", encoded["redirectClassNameForKey"]); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); this.DispatcherUnhandledException += this.OnDispatcherUnhandledException; var virgilHub = ServiceHub.Create(ServiceHubConfig.UseAccessToken(ApiConfig.VirgilToken)); Virgil.SDK.Domain.ServiceLocator.Setup(virgilHub); var updater = new Updater(); updater.Start(); this.Bootstrapper = new Bootstrapper(); this.Bootstrapper.Initialize(); this.AppState = this.Bootstrapper.IoC.Get <ApplicationState>(); this.AppState.Restore(); this.FolderSettings = this.Bootstrapper.IoC.Get <FolderSettingsStorage>(); this.MainWindow = new TrayWindow { DataContext = this.Bootstrapper.IoC.Get <OperationStatusViewModel>() }; ExceptionNotifier.Current.OnDropboxSessionExpired(() => { this.Dispatcher.Invoke(() => { this.Bootstrapper.IoC.Get <IEventAggregator>().Publish(new DropboxSessionExpired()); }); }); this.ShowUI(); }
public MessageController(ServiceHub serviceHub) { this._serviceHub = serviceHub; }
private ServerHandler(ServiceHub serviceHub) { ServiceHub = serviceHub; }
public bool ResolveHub(string uri) { try { CurrentHub = new ServiceHub(); CurrentHub.DestinationAddress = uri; return true; } catch (Exception ex) { //BaseServiceException = ex; //BaseServiceMessage = "The command failed. Please see the BaseServiceException for details."; } return false; }
private void InitializeHubs(Uri address) { EntityManager em = new EntityManager(); List<Hub> hubs = em.GetHubsByGateway(address); foreach(var hub in hubs) { IServiceHub currentHub = new ServiceHub(); currentHub.Name = hub.HubName; currentHub.OriginAddress = address.OriginalString; currentHub.DestinationAddress = address.OriginalString + hub.HubEndpoint; ServiceHubs.Add(currentHub); Console.WriteLine("Gateway: successfully created endpoint {0}.", currentHub.DestinationAddress); currentHub.InitializeSpokes(hub.HubId, currentHub.OriginAddress, currentHub.DestinationAddress); } }
public Current(AuthenticationHub authHub, ServiceHub serviceHub) { this.Authentication = authHub; this.Services = serviceHub; }
/// <summary> /// Setups service locator to use virgil api configuration to access services. /// </summary> /// <param name="config">The configuration.</param> public static void Setup(ServiceHubConfig config) { services = ServiceHub.Create(config); }
/// <summary> /// Setups service locator to use configured virgil hub instance. /// </summary> /// <param name="virgilHub">The virgil hub.</param> public static void Setup(ServiceHub virgilHub) { services = virgilHub; }