async void OnNewModelFromNetwork(object sender, NewModelOnNetworkEventArgs e) { var acceptDownload = await MessageDialogHelper.AskYesNoQuestionAsync( "New Model Available", "Someone on the network has opened a new model, do you want to access it?"); if (acceptDownload) { this.ShowBusy("Downloading model files..."); var modelFilePath = await this.DownloadModelToLocalStorageAsync( e.ModelIdentifier, e.IPAddress); if (!string.IsNullOrEmpty(modelFilePath)) { // Open the model from the file as we would if the user had selected // it via a dialog. var modelDetails = await this.ImportGLTFModelFromFileAsync(modelFilePath); var newModel = modelDetails.GameObject; // Flag that the ID of this model came from over the network, we didn't // open it ourselves. var modelIdentifier = newModel.AddComponent <ModelIdentifier>(); modelIdentifier.AssignExistingFromNetworkedShare(e.ModelIdentifier); // Add positioning. var positioningManager = newModel.AddComponent <ModelPositioningManager>(); positioningManager.InitialiseSizeAndPositioning( this.RootParentProvider.RootParent); // And updates (this handles incoming transformation messages along // with removal messages too) newModel.AddComponent <ModelUpdatesManager>(); // With this model coming from the network, we want to import // the anchor onto the parent to put it into the same place within // the space as on the device it originated from. var worldAnchorBits = await FileStorageManager.LoadExportedWorldAnchorAsync(modelIdentifier.Identifier); if (worldAnchorBits != null) { var anchorManager = newModel.AddComponent <AnchorManager>(); // TODO: if this fails then?... await anchorManager.ImportAnchorToModelParent(worldAnchorBits); } // Let the user know about what to expect with their first shared model. this.AudioManager.PlayClipOnceOnly(AudioClipType.FirstSharedModelOpened); } else { this.AudioManager.PlayClip(AudioClipType.ErrorDownloadingModel); } this.HideBusy(); } }