public IEnumerator TestAutoStartObserver() { var mrtkProfile = CreateMRTKTestProfile(TestSpatialAwarenessSystemProfilePath); TestUtilities.InitializeMixedRealityToolkit(mrtkProfile); yield return(PlayModeTestUtilities.WaitForInputSystemUpdate()); var spatialObserver = CoreServices.GetSpatialAwarenessSystemDataProvider <SpatialObjectMeshObserver.SpatialObjectMeshObserver>(); Assert.IsNotNull(spatialObserver, "No SpatialObjectMeshObserver data provider created or found"); Assert.IsTrue(spatialObserver.WaitingForSceneObserverAccess); Assert.IsNotEmpty(spatialObserver.Meshes); CoreServices.SpatialAwarenessSystem.Disable(); spatialObserver = CoreServices.GetSpatialAwarenessSystemDataProvider <SpatialObjectMeshObserver.SpatialObjectMeshObserver>(); Assert.IsNull(spatialObserver); CoreServices.SpatialAwarenessSystem.Enable(); spatialObserver = CoreServices.GetSpatialAwarenessSystemDataProvider <SpatialObjectMeshObserver.SpatialObjectMeshObserver>(); Assert.IsNotNull(spatialObserver, "No SpatialObjectMeshObserver data provider created or found"); Assert.IsTrue(spatialObserver.WaitingForSceneObserverAccess); yield return(PlayModeTestUtilities.WaitForInputSystemUpdate()); Assert.IsNotEmpty(spatialObserver.Meshes); }
protected override void OnInitialized(EventArgs e) { CoreServices.RegisterServices(); var dialogService = ServiceRepository.Instance.FindService <IDialogService>(); dialogService.MainWindow = this; var windowSettingsRepository = ServiceRepository.Instance.FindService <IWindowSettingsRepository>(); windowSettingsRepository.RestoreSettings(this); dialogService.RegisterDialogHandler(typeof(NewScriptDialogViewModel), vm => new NewScriptDialog()); dialogService.RegisterDialogHandler(typeof(UpdateLocalViewModel), vm => new OkCancelView(new UpdateLocalDialog())); dialogService.RegisterDialogHandler(typeof(GameStatsViewModel), vm => new GameStatsDialog()); dialogService.RegisterDialogHandler(typeof(OpenTicketsViewModel), vm => new OpenTicketsDialog()); dialogService.RegisterDialogHandler(typeof(AboutDialogViewModel), vm => new OkCancelView(new AboutDialog())); dialogService.RegisterDialogHandler(typeof(MessageBoxViewModel), CreateMessageBoxView); var viewModel = new MainWindowViewModel(); viewModel.Initialize(); DataContext = viewModel; base.OnInitialized(e); }
public IEnumerator TestDynamicServices() { TestUtilities.InitializeCamera(); UnityEngine.Object cameraSystemPrefab = AssetDatabase.LoadAssetAtPath("Assets/MixedRealityToolkit.SDK/Experimental/ServiceManagers/Camera/Prefabs/CameraSystem.prefab", typeof(UnityEngine.Object)); Assert.IsNull(CoreServices.CameraSystem); GameObject cameraSystem1 = UnityEngine.Object.Instantiate(cameraSystemPrefab) as GameObject; Assert.IsNotNull(CoreServices.CameraSystem); // Destroying the prefab will cause the CameraSystemManager to unregister the Camera System UnityEngine.Object.DestroyImmediate(cameraSystem1); Assert.IsTrue(CoreServices.ResetCacheReference(typeof(IMixedRealityCameraSystem))); // Force garbage collection GC.Collect(); GC.WaitForPendingFinalizers(); yield return(new WaitForSeconds(1.0f)); Assert.IsNull(CoreServices.CameraSystem); GameObject cameraSystem2 = UnityEngine.Object.Instantiate(cameraSystemPrefab) as GameObject; Assert.IsNotNull(CoreServices.CameraSystem); }
protected override void OnInitialized(EventArgs e) { CoreServices.RegisterServices(); var dialogService = ServiceRepository.Instance.FindService <IDialogService>(); dialogService.MainWindow = this; dialogService.DefaultWindowTitle = "RA Tools"; var windowSettingsRepository = ServiceRepository.Instance.FindService <IWindowSettingsRepository>(); windowSettingsRepository.RestoreSettings(this); dialogService.RegisterDialogHandler(typeof(NewScriptDialogViewModel), vm => new NewScriptDialog()); dialogService.RegisterDialogHandler(typeof(OptionsDialogViewModel), vm => new OkCancelView(new OptionsDialog())); dialogService.RegisterDialogHandler(typeof(UpdateLocalViewModel), vm => new OkCancelView(new UpdateLocalDialog())); dialogService.RegisterDialogHandler(typeof(GameStatsViewModel), vm => new GameStatsDialog()); dialogService.RegisterDialogHandler(typeof(GameStatsViewModel.UserHistoryViewModel), vm => new UserHistoryDialog()); dialogService.RegisterDialogHandler(typeof(OpenTicketsViewModel), vm => new OpenTicketsDialog()); dialogService.RegisterDialogHandler(typeof(AboutDialogViewModel), vm => new OkCancelView(new AboutDialog())); dialogService.RegisterDialogHandler(typeof(ConditionsAnalyzerViewModel), vm => new ConditionsAnalyzerDialog()); dialogService.RegisterDialogHandler(typeof(MasteryViewModel), vm => new MasteryDialog()); var viewModel = new MainWindowViewModel(); viewModel.Initialize(); DataContext = viewModel; base.OnInitialized(e); }
public MainWindow() { InitializeComponent(); CoreServices.RegisterServices(); ServiceRepository.Instance.FindService <IDialogService>().MainWindow = this; DataContext = MainWindowViewModel.Instance; MainWindowViewModel.Instance.ExitCommand = new DelegateCommand(new Action(Close)); var windowSettingsRepository = ServiceRepository.Instance.FindService <IWindowSettingsRepository>(); windowSettingsRepository.RestoreSettings(this); var data = ServiceRepository.Instance.FindService <IPersistantDataRepository>(); var files = data.GetValue("RecentFiles"); if (!String.IsNullOrEmpty(files)) { foreach (var fileName in files.Split(';')) { MainWindowViewModel.Instance.RecentFiles.Add(fileName); } } }
void Init() { NSAutoreleasePool pool = new NSAutoreleasePool(); _callback = new CoreServices.FSEventStreamCallback(OnFsEvent); var pathptrs = new List <IntPtr>(); foreach (string path in _paths) { pathptrs.Add(CoreFoundation.CFSTR(new StringBuilder(path))); } _stream = CoreServices.FSEventStreamCreate(IntPtr.Zero, _callback, IntPtr.Zero, CoreFoundation.CFArrayCreate(pathptrs.ToArray()), CoreServices.kFSEventStreamEventIdSinceNow, 1.0, CoreServices.kFSEventStreamCreateFlagWatchRoot); CoreServices.FSEventStreamScheduleWithRunLoop(_stream, RunLoopHelper.GetRunLoop(), CoreFoundation.kCFRunLoopDefaultMode); CoreServices.FSEventStreamStart(_stream); //CoreServices.FSEventStreamShow(_stream); pool.Dispose(); }
private void TryRenderControllerModelFromOculus() { #if OCULUSINTEGRATION_PRESENT OculusXRSDKDeviceManager deviceManager = CoreServices.GetInputSystemDataProvider <OculusXRSDKDeviceManager>(); if (deviceManager.IsNotNull()) { GameObject platformVisualization = null; if (ControllerHandedness == Handedness.Left) { platformVisualization = deviceManager.leftControllerHelper.gameObject; } else if (ControllerHandedness == Handedness.Right) { platformVisualization = deviceManager.rightControllerHelper.gameObject; } RegisterControllerVisualization(platformVisualization); } #endif if (this != null) { if (OculusControllerVisualization != null && MixedRealityControllerModelHelpers.TryAddVisualizationScript(OculusControllerVisualization, GetType(), ControllerHandedness) && TryAddControllerModelToSceneHierarchy(OculusControllerVisualization)) { OculusControllerVisualization.SetActive(true); return; } Debug.LogWarning("Failed to obtain Oculus controller model; defaulting to BaseController behavior."); base.TryRenderControllerModel(GetType(), InputSource.SourceType); } }
public GameSystems(Contexts contexts, CoreServices coreServices, GameServices gameServices, EditorServices editorServices, GameFactories gameFactories) { //Initialize Add(new RegisterServicesSystem(contexts, coreServices, gameServices, editorServices)); Add(new RegisterFactoriesSystem(contexts, gameFactories)); //Remove Add(new RemoveActionSystem(contexts)); //Action Requests Add(new ActionRequestAddEntityToGridSystem(contexts)); //Actions Add(new ActionAddEntityToGridSystem(contexts)); Add(new ActionCreateMapSystem(contexts)); //Update Add(new UpdateActionDelaySystem(contexts)); Add(new UpdateSelectionColorSystem(contexts)); Add(new UpdateTickSystem(contexts)); //Events Add(new ActionEventSystems(contexts)); Add(new GameEventSystems(contexts)); Add(new MapEditorEventSystems(contexts)); Add(new InputEventSystems(contexts)); //Cleanup Add(new CoreServiceCleanupSystems(contexts)); Add(new DestroyEntitiesSystem(contexts)); }
//Startet das Spatial Mapping //In der Regel besitzt die Hololens 1 einen Observer (eingebaute Kamera),in Simulationen sind mehrere Obsever möglich public void meshObserverstarten(bool mode) { var observer = CoreServices.GetSpatialAwarenessSystemDataProvider <IMixedRealitySpatialAwarenessMeshObserver>(); // var observer = CoreServices.GetSpatialAwarenessSystemDataProvider<IMixedRealitySpatialAwarenessMeshObserver>(); if (mode == true && observer != null) { // Netz sichtbar machen //observer.DisplayOption = SpatialAwarenessMeshDisplayOptions.Visible; Debug.Log("true wird durchlaufen"); // Starte Mesh Obsever observer.Resume(); // CoreServices.SpatialAwarenessSystem.ResumeObservers(); } else { // Netz nicht anzeigen // observer.DisplayOption = SpatialAwarenessMeshDisplayOptions.None; } Debug.Log("Funktion starten wird aufgerufen"); }
public static void AddMapperFactory(this IServiceCollection services) { var factory = new MapperFactory(); factory.Mappers.Add(typeof(CoreServices).Name, CoreServices.GetMapper()); services.AddSingleton <IMapperFactory>(factory); }
/// <summary> /// Utility function to simplify code for getting access to the running InputSimulationService /// </summary> /// <returns>Returns InputSimulationService registered for playmode test scene</returns> public static InputSimulationService GetInputSimulationService() { InputSimulationService inputSimulationService = CoreServices.GetInputSystemDataProvider <InputSimulationService>(); Assert.IsNotNull(inputSimulationService, "InputSimulationService is null!"); return(inputSimulationService); }
/// <summary> /// Utility function to simplify code for getting access to the running InputSimulationService /// </summary> /// <returns>Returns InputSimulationService registered for playmode test scene</returns> public static InputSimulationService GetInputSimulationService() { InputSimulationService inputSimulationService = CoreServices.GetInputSystemDataProvider <InputSimulationService>(); Debug.Assert((inputSimulationService != null), "InputSimulationService is null!"); return(inputSimulationService); }
protected override void Start() { base.Start(); dictationSystem = CoreServices.GetInputSystemDataProvider <IMixedRealityDictationSystem>(); Debug.Assert(dictationSystem != null, "No dictation system found. In order to use dictation, add a dictation system like 'Windows Dictation Input Provider' to the Data Providers in the Input System profile"); StartRecording(); }
public static IEnumerable <CoreServiceInfo> FindServices(string name, bool ignoreCase = true) { return (CoreServices.Where( csi => String.Equals( csi.Name, name, ignoreCase ? StringComparison.InvariantCultureIgnoreCase : StringComparison.InvariantCulture))); }
public void Reset() { SetupClass.Initialize(); try { CoreServices.Stop(); } catch { } }
public void Reset() { SetupClass.SetUp(); try { CoreServices.Stop(); } catch { } }
/// <summary> /// Register <see cref="IService"/> exposed by addins through the <see cref="IServicesPlugin"/> extension point. /// </summary> public static void LoadServicesAddins () { foreach (IServicesPlugin plugin in AddinManager.GetExtensionObjects<IServicesPlugin> ()) { foreach (IService service in plugin.Services) { CoreServices.RegisterService (service); } } }
/*! * \brief Set spatial mapping not visible using voice recognizer ("Mapping Off" keyword) */ public void SetNotVisible() { var observer = CoreServices.GetSpatialAwarenessSystemDataProvider <IMixedRealitySpatialAwarenessMeshObserver>(); if (observer.DisplayOption != SpatialAwarenessMeshDisplayOptions.None) { observer.DisplayOption = SpatialAwarenessMeshDisplayOptions.None; } }
public void DisableReadingMode() { var projectionOverrideProvider = CoreServices.GetCameraSystemDataProvider <IMixedRealityCameraProjectionOverrideProvider>(); if (projectionOverrideProvider != null) { projectionOverrideProvider.IsProjectionOverrideEnabled = false; } }
/// <summary> /// Set up Dictation, CanvasEX, and automatically select the TextInput object. /// </summary> protected override void Start() { base.Start(); dictationSystem = CoreServices.GetInputSystemDataProvider <IMixedRealityDictationSystem>(); // Delegate Subscription InputField.onValueChanged.AddListener(DoTextUpdated); }
public void Start() { observer = CoreServices.GetSpatialAwarenessSystemDataProvider <IMixedRealitySpatialAwarenessMeshObserver>(); foreach (GameObject gO in destinations) { searchDestinations.Add(gO.name, gO); } lr.enabled = false; textToSpeech.StartSpeaking("Welcome to HoloAssist! Wait a few seconds to scan your surroundings. Say the destination out loud to see the path."); }
protected override void Start() { observer = CoreServices.GetSpatialAwarenessSystemDataProvider <IMixedRealitySceneUnderstandingObserver>(); if (observer == null) { Debug.LogError("Couldn't access Scene Understanding Observer!"); return; } InitToggleButtonState(); }
public void Dispose() { Trace(DateTime.Now + " FsEventsWatcher: stop stream"); CoreServices.FSEventStreamStop(_stream); Trace(DateTime.Now + " FsEventsWatcher: invalidate stream"); CoreServices.FSEventStreamInvalidate(_stream); Trace(DateTime.Now + " FsEventsWatcher: release stream"); CoreServices.FSEventStreamRelease(_stream); _callback = null; Trace(DateTime.Now + " FsEventsWatcher: disposed"); }
private void Receive(object sender, EventReceivedArgs args) { Channel ch = OpenChannel(args.Event); bool isFirst = true; void Reply(ErrorInformation error, object value, bool more) { if (error != null) { SendError(ch, error); } else { if (isFirst && !more) { ch.Send("OK", new object[] { new[] { value } }); // Wrap into an array for backwards compatibility } else if (value != null) { ch.Send("STREAM", value); } if (!more) { if (!isFirst) { ch.Send("STREAM_DONE"); } CloseChannel(ch); } } isFirst = false; } ch.Error += (o, errorArgs) => RaiseError(errorArgs.Info); try { if (CoreServices.HasEvent(args.Event.Name)) { CoreServices.Invoke(this, args.Event.Name, ArgumentUnpacker.Unpack(args.Event.Args), Reply); } else { Service.Invoke(args.Event.Name, ArgumentUnpacker.Unpack(args.Event.Args), Reply); } } catch (Exception e) { SendError(ch, new ErrorInformation(e.GetType().Name, e.Message, e.StackTrace)); } }
public void TestMigratingOldDatabase() { string tmpPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); string homePath = Path.Combine(tmpPath, "LongoMatch"); string dbPath = Path.Combine(homePath, "db"); string lmdbPath = Path.Combine(dbPath, "longomatch.ldb"); string teamsPath = Path.Combine(dbPath, "teams"); string dashboardsPath = Path.Combine(dbPath, "analysis"); Directory.CreateDirectory(tmpPath); Directory.CreateDirectory(homePath); Directory.CreateDirectory(dbPath); Directory.CreateDirectory(lmdbPath); Directory.CreateDirectory(teamsPath); Directory.CreateDirectory(dashboardsPath); Utils.SaveResource("spain.ltt", teamsPath); Utils.SaveResource("france.ltt", teamsPath); Utils.SaveResource("basket.lct", dashboardsPath); Utils.SaveResource("spain_france_test.lgm", lmdbPath); // Create an empty project file that shouldn't be converter File.Open(Path.Combine(lmdbPath, "empty.lgm"), FileMode.Create); Directory.CreateDirectory(tmpPath); Environment.SetEnvironmentVariable("LONGOMATCH_HOME", tmpPath); Environment.SetEnvironmentVariable("LGM_UNINSTALLED", "1"); App.Init(); CoreServices.Init(); App.Current.LicenseManager = mockLicenseManager.Object; App.Current.LicenseLimitationsService = mockLicenseLimitationService.Object; App.Current.PreviewService = new Mock <IPreviewService> ().Object; CoreServices.Start(guiToolkitMock.Object, multimediaToolkitMock.Object); Assert.AreEqual(0, App.Current.DatabaseManager.ActiveDB.Count <LMProject> ()); Assert.AreEqual(2, App.Current.TeamTemplatesProvider.Templates.Count); Assert.AreEqual(1, App.Current.CategoriesTemplatesProvider.Templates.Count); DatabaseMigration dbMigration = new DatabaseMigration(Mock.Of <IProgressReport> ()); dbMigration.Start(); App.Current.DatabaseManager.SetActiveByName("longomatch"); Assert.AreEqual(4, App.Current.TeamTemplatesProvider.Templates.Count); Assert.AreEqual(2, App.Current.CategoriesTemplatesProvider.Templates.Count); Assert.AreEqual(1, App.Current.DatabaseManager.ActiveDB.Count <LMProject> ()); Assert.IsTrue(File.Exists(Path.Combine(dbPath, "templates", "backup", "spain.ltt"))); Assert.IsTrue(File.Exists(Path.Combine(dbPath, "templates", "backup", "france.ltt"))); Assert.IsTrue(File.Exists(Path.Combine(dbPath, "templates", "backup", "basket.lct"))); Assert.IsTrue(File.Exists(Path.Combine(dbPath, "old", "longomatch.ldb", "spain_france_test.lgm"))); CoreServices.Stop(); }
public Mesh GetSpatialMesh() { var meshObserver = CoreServices.GetSpatialAwarenessSystemDataProvider <IMixedRealitySpatialAwarenessMeshObserver>(); var meshFilters = new List <MeshFilter>(from meshFilter in meshObserver.Meshes.Values select meshFilter.Filter); if (meshFilters.Count > 0) { return(CombineMeshes(new List <MeshFilter>(from meshFilter in meshObserver.Meshes.Values select meshFilter.Filter))); } return(new Mesh()); }
public static ServiceProvider ConfigureServices(IServiceCollection services) { services.AddHttpClient(); CoreServices.ConfigureServices(services); services.AddTransient <IContentsDisplayHandler, ContentsDisplayHandler>() .AddSingleton <IPhotoAlbumApplicationHandler, PhotoAlbumApplicationHandler>() .AddTransient <Introduction>() .AddTransient <RequestAlbumNumber>(); return(services.BuildServiceProvider(true)); }
static void Main(string[] args) { Console.CancelKeyPress += Console_CancelKeyPress; using (var logger = new Logger("Program", new MaxLoggingPermissions(), FileLogWriter.InTempFolder("Microsoft.R.Host.Client.Program"))) { var services = new CoreServices(new AppConstants(), null, null, null, null); var localConnector = new LocalBrokerClient("Program", args[0], services, new NullConsole()); var host = localConnector.ConnectAsync(new BrokerConnectionInfo("Program", new Program())).GetAwaiter().GetResult(); _evaluator = host; host.Run().GetAwaiter().GetResult(); } }
void Awake() { Application.targetFrameRate = 60; _contexts = Contexts.sharedInstance; _contexts.SubscribeId(); _coreServices = new CoreServices(new UnityViewService(), new InputService(_contexts), new UnityInputController(new UnityInputMapper()), new CollisionService(_contexts), new SelectionService(_contexts), new UnityTimeService(), new TickService(_contexts)); _gameServices = new GameServices(new GridService(_contexts)); _editorServices = new EditorServices(new GridEditorService(_contexts, new UnityMapEditorAssetLoader(), new GridEditorToolsService(), new GridEditorNavigationService(), new GridEditorObjectService())); _gameFactories = new GameFactories(new TileFactory(_contexts)); _systems = CreateSystems(); _systems.Initialize(); var grid = _contexts.grid.CreateGrid(10, 10, 1, 1, ObjectType.OBJECT_CATEGORY_TILE); var e = _contexts.game.CreateEntity(); _coreServices.View.LoadAsset(_contexts, e, GlobalVariables.ResourcesAssetsPath + "prefabs/miner"); e.AddPosition(-3, 3); e.AddVisible(true); e.AddSelectionColor(newSelectionDown: new Color(0.0f, 1.0f, 0.0f, 1.0f), newSelectionHeld: new Color(), newSelectionHoverIn: new Color(), newSelectionHoverOut: new Color(), newSelectionHoverSelect: new Color(), newSelectionUp: new Color()); var action = _contexts.action.CreateEntity(); action.AddActionCreateMap(new Vector2Int(10, 10), TileType.Stone, TileType.Stone); // var command = new CommandCreateMapEditor(_contexts, grid.id.value); // command.DoCommand(); var tick = _contexts.game.CreateEntity(); var newTick = new Tick() { delayValue = 0.05f, delay = 1, multiplier = 1f }; tick.AddTick(new Dictionary <TickEnum, Tick>() { { TickEnum.MapEditor_AssetLoading, newTick } }); }
void GetLeftJointTransforms() { var handJointService = CoreServices.GetInputSystemDataProvider <IMixedRealityHandJointService>(); if (handJointService != null) { for (int i = 1; i < 27; i++) { mrtkTransformsLeft.Add(handJointService.RequestJointTransform((TrackedHandJoint)i, Handedness.Left)); } } }
public LoginControl(CoreServices.LoginCallback callback) : this() { _delegate = callback; }