AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
ApplicationViewManagerEditButton.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using System.Collections;
5 using UnityEngine;
6 using UnityEngine.UI;
7 
8 namespace HoloToolkit.Unity.Tests
9 {
10  [RequireComponent(typeof(ApplicationViewManager))]
11  public class ApplicationViewManagerEditButton : MonoBehaviour
12  {
13  public delegate void LaunchXmlView(string result);
14 
18  public event LaunchXmlView OnResult;
19 
20  public Text Field;
21 
22  private ApplicationViewManager viewManager;
23 
24  private void Awake()
25  {
26  viewManager = gameObject.EnsureComponent<ApplicationViewManager>();
27  }
28 
29  public void StartEdit()
30  {
31  StartCoroutine(OpenViewEdit());
32  }
33 
34  private IEnumerator OpenViewEdit()
35  {
36  string result = string.Empty;
37 
38  yield return viewManager.OnLaunchXamlView<string>("TestPage", s => result = s);
39 
40  yield return new WaitUntil(() => !string.IsNullOrEmpty(result));
41 
42  if (OnResult != null)
43  {
44  OnResult(result);
45  }
46 
47  if (Field != null)
48  {
49  Field.text = result;
50  }
51  }
52  }
53 }
ApplicationViewManager ( For XAML UWP project) can switch app to Plan View, populate an Application V...
LaunchXmlView OnResult
Event to subscribe to when a text result is returned from the XML view.