private void BindCustomTabsService() { if (custom_tabs_client != null) { return; } if (TextUtils.IsEmpty(mPackageNameToBind)) { mPackageNameToBind = PackageManagerHelper.GetPackageNameToUseDefaultUri(this); if (mPackageNameToBind == null) { return; } } custom_tabs_service_connection = new ServiceConnection(this); bool ok = CustomTabsClient.BindCustomTabsService(this, mPackageNameToBind, custom_tabs_service_connection); if (ok) { mConnectButton.Enabled = false; } else { custom_tabs_service_connection = null; } }
/// <summary> /// Binds the Activity to the Custom Tabs Service. </summary> /// <param name="activity"> the activity to be binded to the service. </param> public virtual void BindCustomTabsService(Activity activity) { if (custom_tabs_client != null) { return; } ; List <string> packages = PackageManagerHelper.GetPackageNameToUse(activity, this.UriTest); string packageName = ""; if (packageName == null) { Toast.MakeText ( activity, "No packages supporting CustomTabs found!", ToastLength.Short ).Show(); return; } custom_tabs_service_connection = new ServiceConnection(this); CustomTabsClient.BindCustomTabsService(activity, packageName, custom_tabs_service_connection); return; }
public void Load() { var list = PackageManagerHelper.GetPackagesForAllUserWithPackageTypesOnlyRemovable(Windows.Management.Deployment.PackageTypes.Main); this.AppxPackages = new ObservableCollection <AppxPackage>(list); SystemInfo = $"Installed packages: {AppxPackages.Count} | User: {GetUserName()} | Build: {GetBuildNumber()}"; }
public override void OnPreferenceGUI() { const string title = "Windows MR"; if (canSupport) { var wasSupported = support; support = m_foldouter.ShowFoldoutButtonOnToggleEnabled(new GUIContent(title, "Windows MR"), wasSupported); s_symbolChanged |= wasSupported != support; } else { GUILayout.BeginHorizontal(); Foldouter.ShowFoldoutBlank(); if (activeBuildTargetGroup != BuildTargetGroup.Standalone) { GUI.enabled = false; ShowToggle(new GUIContent(title, "Standalone platform required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowSwitchPlatformButton(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64); } #if UNITY_2020_2_OR_NEWER && FALSE // openxr not fully supported yet else if (!PackageManagerHelper.IsPackageInList(OPENXR_PLUGIN_PACKAGE_NAME)) { GUI.enabled = false; ShowToggle(new GUIContent(title, "OpenXR Plugin package required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowAddPackageButton("OpenXR Plugin", OPENXR_PLUGIN_PACKAGE_NAME); } #elif UNITY_2019_3_OR_NEWER else if (!PackageManagerHelper.IsPackageInList(WINDOWSMR_XR_PACKAGE_NAME)) { GUI.enabled = false; ShowToggle(new GUIContent(title, "Windows XR Plugin package required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowAddPackageButton("Windows XR Plugin", WINDOWSMR_XR_PACKAGE_NAME); } #elif UNITY_2018_2_OR_NEWER else if (!PackageManagerHelper.IsPackageInList(WINDOWSMR_PACKAGE_NAME)) { GUI.enabled = false; ShowToggle(new GUIContent(title, "Windows Mixed Reality package required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowAddPackageButton("Windows Mixed Reality", WINDOWSMR_PACKAGE_NAME); } #endif GUILayout.EndHorizontal(); } }
public override void OnPreferenceGUI() { const string title = "Oculus Desktop"; if (canSupport) { support = Foldouter.ShowFoldoutBlankWithEnabledToggle(new GUIContent(title, "Oculus Rift, Oculus Rift S"), support); } else { GUILayout.BeginHorizontal(); Foldouter.ShowFoldoutBlank(); if (activeBuildTargetGroup != BuildTargetGroup.Standalone) { GUI.enabled = false; ShowToggle(new GUIContent(title, "Standalone platform required."), false, GUILayout.Width(150f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowSwitchPlatformButton(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64); } #if UNITY_2019_3_OR_NEWER else if (!PackageManagerHelper.IsPackageInList(OCULUS_XR_PACKAGE_NAME)) { GUI.enabled = false; ShowToggle(new GUIContent(title, "Oculus XR Plugin package required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowAddPackageButton("Oculus XR Plugin", OCULUS_XR_PACKAGE_NAME); } #endif #if !UNITY_2020_1_OR_NEWER else if (!PackageManagerHelper.IsPackageInList(OCULUS_DESKTOP_PACKAGE_NAME)) { GUI.enabled = false; ShowToggle(new GUIContent(title, "Oculus (Desktop) package required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowAddPackageButton("Oculus (Desktop)", OCULUS_DESKTOP_PACKAGE_NAME); } #endif else if (!VRModule.isOculusVRPluginDetected) { GUI.enabled = false; ShowToggle(new GUIContent(title, "Oculus VR Plugin required."), false, GUILayout.Width(150f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowUrlLinkButton(URL_OCULUS_VR_PLUGIN); } GUILayout.EndHorizontal(); } }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { if (IsInDesignMode) { // Code runs in Blend --> create design time data. return; } RefreshCmd = new RelayCommand(() => { this.AppxPackages.Clear(); this.Load(); }); SelectAllCmd = new RelayCommand(() => { foreach (var item in this.AppxPackages) { item.IsCheck = !item.IsCheck; } }); RemovePackageCmd = new RelayCommand(() => { var removedList = new List <AppxPackage>(); foreach (var item in this.AppxPackages) { if (item.IsCheck.HasValue && item.IsCheck.Value) { try { PackageManagerHelper.RemovePackage(item.FullName); if (string.IsNullOrEmpty(item.UserName))//非当前用户 { //TODO } removedList.Add(item); } catch (Exception ex) { } } } foreach (var item in removedList) { this.AppxPackages.Remove(item); } }); }
public static void Initialize(global::Android.App.Activity a) { activity = a; List <string> packages = PackageManagerHelper.GetPackageNameToUse ( global::Android.App.Application.Context, "http://xamarin.com" ); PackagesSupportingCustomTabs = PackageManagerHelper.PackagesSupportingCustomTabs; PackageForCustomTabs = PackagesSupportingCustomTabs.FirstOrDefault().Value; CustomTabsActivityManager = new CustomTabsActivityManager(a); CustomTabsIntentBuilder = new CustomTabsIntent.Builder(CustomTabsActivityManager.Session); CustomTabActivityHelper = new CustomTabActivityHelper(); return; }
/// <summary> /// Opens the URL on a Custom Tab if possible. Otherwise fallsback to opening it on a WebView. /// </summary> /// <param name="activity"> The host activity. </param> /// <param name="custom_tabs_intent"> a CustomTabsIntent to be used if Custom Tabs is available. </param> /// <param name="uri"> the Uri to be opened. </param> /// <param name="fallback"> a CustomTabFallback to be used if Custom Tabs is not available. </param> public /*static*/ void LaunchUrlWithCustomTabsOrFallback ( Activity a, CustomTabsIntent custom_tabs_intent, Android.Net.Uri u, ICustomTabFallback fallback ) { uri = u; activity = a; string packageName = PackageManagerHelper.GetPackageNameToUse(activity, uri.ToString()); //If we cant find a package name, it means theres no browser that supports //Chrome Custom Tabs installed. So, we fallback to the webview if (packageName == null) { if (fallback != null) { fallback.OpenUri(activity, uri); } } else { custom_tabs_intent.Intent.SetPackage(packageName); // direct call to CustomtTasIntent.LaunchUrl was ported from java samples and refactored // seems like API changed // // custom_tabs_intent.LaunchUrl(activity, uri); custom_tabs_activit_manager = new CustomTabsActivityManager(activity); custom_tabs_activit_manager.CustomTabsServiceConnected += custom_tabs_activit_manager_CustomTabsServiceConnected; service_bound = custom_tabs_activit_manager.BindService(); if (service_bound == false) { // No Packages that support CustomTabs } } return; }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); #if !DEBUG App.Tracker.Send(HitBuilder.CreateScreenView("Send").Build()); #endif PersistentDisplay.ActivatePersistentDisplay(); if (Frame.BackStackDepth > 0) { if (Frame.BackStack[Frame.BackStackDepth - 1].SourcePageType == typeof(MainSend)) { Frame.BackStack.RemoveAt(Frame.BackStackDepth - 1); } } bool preserveFolderStructure = (Frame.BackStackDepth <= 0 || Frame.BackStack[Frame.BackStackDepth - 1].SourcePageType != typeof(PicturePicker)); var rs = MainPage.Current.GetSelectedSystem(); bool isDestinationAndroid; IRomePackageManager packageManager; if (rs is NormalizedRemoteSystem) { isDestinationAndroid = true; var nrs = rs as NormalizedRemoteSystem; if ((!string.IsNullOrEmpty(nrs.AppVersion)) && (Version.TryParse(nrs.AppVersion, out Version remoteAppVersion)) && (remoteAppVersion < new Version("2.1.4"))) { MainPage.Current.AndroidPackageManager.Mode = AndroidRomePackageManager.AndroidPackageManagerMode.MessageCarrier; } else { PackageManagerHelper.InitAndroidPackageManagerMode(); } } else { isDestinationAndroid = false; } string deviceName; var localDeviceInfo = NetworkInformation.GetHostNames().FirstOrDefault(name => name.DisplayName.EndsWith(".local")); if (localDeviceInfo != null) { deviceName = localDeviceInfo.DisplayName.Substring(0, localDeviceInfo.DisplayName.Length - ".local".Length); } else { deviceName = (new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation()).FriendlyName; } var mode = e.Parameter.ToString(); bool succeed = true; FileTransferResult fileTransferResult = FileTransferResult.Successful; try { if (mode == "launchUri") { await LaunchUri(rs); } else if (mode == "text") { string text = SendDataTemporaryStorage.Text; bool fastSendResult = await TrySendFastClipboard(text, rs, deviceName); if (fastSendResult) { SendTextFinished(""); } else { SendTextFinished("Send failed. Text is too long."); #if !DEBUG App.Tracker.Send(HitBuilder.CreateCustomEvent("SendTextFailed", "TooLong").Build()); #endif //ViewModel.ProgressPercentIndicatorVisibility = Visibility.Visible; //var result = await Connect(rs); //var connectResult = result.Item1; //packageManager = result.Item2; //if (connectResult != RomeAppServiceConnectionStatus.Success) //{ // HideEverything(); // succeed = false; // string errorMessage; // if ((connectResult == RomeAppServiceConnectionStatus.RemoteSystemUnavailable) && (packageManager is AndroidRomePackageManager)) // { // errorMessage = "Can't connect to device. Open Roamit on your Android device and then try again."; // } // else // { // errorMessage = connectResult.ToString(); // } // Frame.Navigate(typeof(MainSendFailed), JsonConvert.SerializeObject(new SendFailedViewModel // { // ErrorTitle = "Can't connect", // ErrorDescription = errorMessage, // })); // return; //} //ViewModel.UnlockNoticeVisibility = Visibility.Collapsed; //await SendText(packageManager, deviceName, text); } } else if (mode == "file") { ViewModel.ProgressPercentIndicatorVisibility = Visibility.Visible; var result = await Connect(rs, openReceiveFileDialogIfOverCloud : true); var connectResult = result.Item1; packageManager = result.Item2; if (connectResult != RomeAppServiceConnectionStatus.Success) { HideEverything(); succeed = false; string errorMessage; if ((connectResult == RomeAppServiceConnectionStatus.RemoteSystemUnavailable) && (packageManager is AndroidRomePackageManager)) { errorMessage = "Can't connect to device. Open Roamit on your Android device and then try again."; } else { errorMessage = connectResult.ToString(); } Frame.Navigate(typeof(MainSendFailed), JsonConvert.SerializeObject(new SendFailedViewModel { ErrorTitle = "Can't connect", ErrorDescription = errorMessage, })); return; } ViewModel.UnlockNoticeVisibility = Visibility.Collapsed; if (!isDestinationAndroid) { ViewModel.LeaveScreenOnNoticeVisibility = Visibility.Visible; } fileTransferResult = await SendFile(rs, packageManager, deviceName, preserveFolderStructure); if (fileTransferResult != FileTransferResult.Successful) { succeed = false; return; } if (!isDestinationAndroid) { ViewModel.LeaveScreenOnNoticeVisibility = Visibility.Collapsed; } } else { succeed = false; Frame.Navigate(typeof(MainSendFailed), JsonConvert.SerializeObject(new SendFailedViewModel { ErrorTitle = "Invalid parameter", ErrorDescription = "[MainSend]", })); return; } } finally { PersistentDisplay.ReleasePersistentDisplay(); #if !DEBUG if (rs is NormalizedRemoteSystem) { App.Tracker.Send(HitBuilder.CreateCustomEvent("SendToAndroid", mode, succeed ? "Success" : ((mode == "file") ? fileTransferResult.ToString() : "Failed")).Build()); } else { App.Tracker.Send(HitBuilder.CreateCustomEvent("SendToWindows", mode, succeed ? "Success" : ((mode == "file") ? fileTransferResult.ToString() : "Failed")).Build()); } #endif sendingFile = false; } if (SendDataTemporaryStorage.IsSharingTarget) { if (App.ShareOperation == null) { #if !DEBUG App.Tracker.Send(HitBuilder.CreateCustomEvent("Send", "UriTarget").Build()); #endif await Task.Delay(TimeSpan.FromSeconds(1.5)); App.Current.Exit(); } else { #if !DEBUG App.Tracker.Send(HitBuilder.CreateCustomEvent("Send", "ShareTarget").Build()); #endif await Task.Delay(TimeSpan.FromSeconds(1.5)); App.ShareOperation.ReportCompleted(); } SendDataTemporaryStorage.IsSharingTarget = false; App.ShareOperation = null; } else { ViewModel.GoBackButtonVisibility = Visibility.Visible; GoBackButtonShowStoryboard.Begin(); if (succeed) { await AskForReviewIfNecessary(); } #if !DEBUG App.Tracker.Send(HitBuilder.CreateCustomEvent("Send", "WithinApp").Build()); #endif } }
public override void OnPreferenceGUI() { const string title = "OpenVR"; if (canSupport) { support = m_foldouter.ShowFoldoutButtonOnToggleEnabled(new GUIContent(title, "VIVE, VIVE Pro, VIVE Pro Eye, VIVE Cosmos\nOculus Rift, Oculus Rift S, Windows MR"), support); } else { GUILayout.BeginHorizontal(); Foldouter.ShowFoldoutBlank(); if (activeBuildTargetGroup != BuildTargetGroup.Standalone) { GUI.enabled = false; ShowToggle(new GUIContent(title, "Standalone platform required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowSwitchPlatformButton(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64); } #if UNITY_2019_3_OR_NEWER else if (!PackageManagerHelper.IsPackageInList(OPENVR_XR_PACKAGE_NAME)) { GUI.enabled = false; ShowToggle(new GUIContent(title, "OpenVR XR Plugin package required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); bool hasValveRegistryAdded = RegistryToolSettings.IsRegistryExists(ValveRegistry); if (hasValveRegistryAdded) { ShowAddPackageButton("OpenVR XR Plugin", OPENVR_XR_PACKAGE_NAME); } else { if (GUILayout.Button(new GUIContent("Add Valve Registry"))) { bool result = EditorUtility.DisplayDialog( "Add Valve Registry", "Do you want to add Valve registry to your project?\n\nBy adding the Valve registry (" + ValveRegistry.url + ") in your 'Packages/manifest.json', VIU can install OpenVR XR Plugin for you.\n\nIn addition, you can discover, install, update or remove the packages from Valve in the package manager window later.", "Add", "Cancel"); if (result) { RegistryToolSettings.AddRegistry(ValveRegistry); } } } } #endif #if !UNITY_2020_1_OR_NEWER else if (!PackageManagerHelper.IsPackageInList(OPENVR_PACKAGE_NAME)) { GUI.enabled = false; ShowToggle(new GUIContent(title, "OpenVR (Desktop) package required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowAddPackageButton("OpenVR (Desktop)", OPENVR_PACKAGE_NAME); } #endif else if (!VRModule.isSteamVRPluginDetected) { GUI.enabled = false; ShowToggle(new GUIContent(title, "SteamVR Plugin required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowUrlLinkButton(URL_STEAM_VR_PLUGIN); } GUILayout.EndHorizontal(); } if (support && m_foldouter.isExpended) { if (support && VRModule.isSteamVRPluginDetected) { EditorGUI.BeginChangeCheck(); } else { GUI.enabled = false; } { EditorGUI.indentLevel += 2; VIUSettings.autoLoadExternalCameraConfigOnStart = EditorGUILayout.ToggleLeft(new GUIContent("Load Config and Enable External Camera on Start", "You can also load config by calling ExternalCameraHook.LoadConfigFromFile(path) in script."), VIUSettings.autoLoadExternalCameraConfigOnStart); if (!VIUSettings.autoLoadExternalCameraConfigOnStart && support) { GUI.enabled = false; } { EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); VIUSettings.externalCameraConfigFilePath = EditorGUILayout.DelayedTextField(new GUIContent("Config Path"), VIUSettings.externalCameraConfigFilePath); if (string.IsNullOrEmpty(VIUSettings.externalCameraConfigFilePath)) { VIUSettings.externalCameraConfigFilePath = VIUSettings.EXTERNAL_CAMERA_CONFIG_FILE_PATH_DEFAULT_VALUE; EditorGUI.EndChangeCheck(); } else if (EditorGUI.EndChangeCheck() && VIUSettings.externalCameraConfigFilePath.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) { VIUSettings.externalCameraConfigFilePath = VIUSettings.EXTERNAL_CAMERA_CONFIG_FILE_PATH_DEFAULT_VALUE; } // Create button that writes default config file if (VIUSettings.autoLoadExternalCameraConfigOnStart && support && !File.Exists(VIUSettings.externalCameraConfigFilePath)) { if (support && VRModule.isSteamVRPluginDetected) { s_guiChanged |= EditorGUI.EndChangeCheck(); } ShowCreateExCamCfgButton(); if (support && VRModule.isSteamVRPluginDetected) { EditorGUI.BeginChangeCheck(); } } EditorGUI.indentLevel--; } if (!VIUSettings.autoLoadExternalCameraConfigOnStart && support) { GUI.enabled = true; } VIUSettings.enableExternalCameraSwitch = EditorGUILayout.ToggleLeft(new GUIContent("Enable External Camera Switch", VIUSettings.EX_CAM_UI_SWITCH_TOOLTIP), VIUSettings.enableExternalCameraSwitch); if (!VIUSettings.enableExternalCameraSwitch && support) { GUI.enabled = false; } { EditorGUI.indentLevel++; VIUSettings.externalCameraSwitchKey = (KeyCode)EditorGUILayout.EnumPopup("Switch Key", VIUSettings.externalCameraSwitchKey); VIUSettings.externalCameraSwitchKeyModifier = (KeyCode)EditorGUILayout.EnumPopup("Switch Key Modifier", VIUSettings.externalCameraSwitchKeyModifier); EditorGUI.indentLevel--; } if (!VIUSettings.enableExternalCameraSwitch && support) { GUI.enabled = true; } EditorGUI.indentLevel -= 2; } if (support && VRModule.isSteamVRPluginDetected) { s_guiChanged |= EditorGUI.EndChangeCheck(); } else { GUI.enabled = true; } } if (support && !VRModule.isSteamVRPluginDetected) { EditorGUI.indentLevel += 2; #if VIU_XR_GENERAL_SETTINGS GUILayout.BeginHorizontal(); EditorGUILayout.HelpBox("For now, to get access to controllers and other forms of input, you will need to install the beta version of the SteamVR Unity Plugin.", MessageType.Warning); s_warningHeight = Mathf.Max(s_warningHeight, GUILayoutUtility.GetLastRect().height); GUILayout.BeginVertical(GUILayout.Height(s_warningHeight)); GUILayout.FlexibleSpace(); ShowUrlLinkButton(URL_STEAM_VR_PLUGIN_BETA, "Get SteamVR Plugin (beta)"); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); #else GUILayout.BeginHorizontal(); EditorGUILayout.HelpBox("External-Camera(Mix-Reality), animated controller model" + ", VIVE Controller haptics(vibration)" + #if UNITY_2017_1_OR_NEWER ", VIVE Tracker USB/Pogo-pin input" + #else ", VIVE Tracker device" + #endif " NOT supported! " + #if VIU_PACKAGE "Install SteamVR Plugin 2.4.0 or newer to get support." #else "Install SteamVR Plugin to get support." #endif , MessageType.Warning); s_warningHeight = Mathf.Max(s_warningHeight, GUILayoutUtility.GetLastRect().height); GUILayout.BeginVertical(GUILayout.Height(s_warningHeight)); GUILayout.FlexibleSpace(); ShowUrlLinkButton(URL_STEAM_VR_PLUGIN, "Get SteamVR Plugin"); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); #endif EditorGUI.indentLevel -= 2; } }
public override void OnPreferenceGUI() { const string title = "VIVE <size=9>(OpenVR compatible device)</size>"; if (canSupport) { support = m_foldouter.ShowFoldoutButtonOnToggleEnabled(new GUIContent(title), support); } else { GUILayout.BeginHorizontal(); Foldouter.ShowFoldoutBlank(); if (activeBuildTargetGroup != BuildTargetGroup.Standalone) { GUI.enabled = false; ShowToggle(new GUIContent(title, "Standalone platform required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowSwitchPlatformButton(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64); } else if (!PackageManagerHelper.IsPackageInList(OPENVR_PACKAGE_NAME)) { GUI.enabled = false; ShowToggle(new GUIContent(title, "OpenVR (Desktop) package required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowAddPackageButton("OpenVR (Desktop)", OPENVR_PACKAGE_NAME); } else if (!VRModule.isSteamVRPluginDetected) { GUI.enabled = false; ShowToggle(new GUIContent(title, "SteamVR Plugin required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowUrlLinkButton(URL_STEAM_VR_PLUGIN); } GUILayout.EndHorizontal(); } if (support && m_foldouter.isExpended) { if (support && VRModule.isSteamVRPluginDetected) { EditorGUI.BeginChangeCheck(); } else { GUI.enabled = false; } { EditorGUI.indentLevel += 2; VIUSettings.autoLoadExternalCameraConfigOnStart = EditorGUILayout.ToggleLeft(new GUIContent("Load Config and Enable External Camera on Start", "You can also load config by calling ExternalCameraHook.LoadConfigFromFile(path) in script."), VIUSettings.autoLoadExternalCameraConfigOnStart); if (!VIUSettings.autoLoadExternalCameraConfigOnStart && support) { GUI.enabled = false; } { EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); VIUSettings.externalCameraConfigFilePath = EditorGUILayout.DelayedTextField(new GUIContent("Config Path"), VIUSettings.externalCameraConfigFilePath); if (string.IsNullOrEmpty(VIUSettings.externalCameraConfigFilePath)) { VIUSettings.externalCameraConfigFilePath = VIUSettings.EXTERNAL_CAMERA_CONFIG_FILE_PATH_DEFAULT_VALUE; EditorGUI.EndChangeCheck(); } else if (EditorGUI.EndChangeCheck() && VIUSettings.externalCameraConfigFilePath.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) { VIUSettings.externalCameraConfigFilePath = VIUSettings.EXTERNAL_CAMERA_CONFIG_FILE_PATH_DEFAULT_VALUE; } // Create button that writes default config file if (VIUSettings.autoLoadExternalCameraConfigOnStart && support && !File.Exists(VIUSettings.externalCameraConfigFilePath)) { if (support && VRModule.isSteamVRPluginDetected) { s_guiChanged |= EditorGUI.EndChangeCheck(); } ShowCreateExCamCfgButton(); if (support && VRModule.isSteamVRPluginDetected) { EditorGUI.BeginChangeCheck(); } } EditorGUI.indentLevel--; } if (!VIUSettings.autoLoadExternalCameraConfigOnStart && support) { GUI.enabled = true; } VIUSettings.enableExternalCameraSwitch = EditorGUILayout.ToggleLeft(new GUIContent("Enable External Camera Switch", VIUSettings.EX_CAM_UI_SWITCH_TOOLTIP), VIUSettings.enableExternalCameraSwitch); if (!VIUSettings.enableExternalCameraSwitch && support) { GUI.enabled = false; } { EditorGUI.indentLevel++; VIUSettings.externalCameraSwitchKey = (KeyCode)EditorGUILayout.EnumPopup("Switch Key", VIUSettings.externalCameraSwitchKey); VIUSettings.externalCameraSwitchKeyModifier = (KeyCode)EditorGUILayout.EnumPopup("Switch Key Modifier", VIUSettings.externalCameraSwitchKeyModifier); EditorGUI.indentLevel--; } if (!VIUSettings.enableExternalCameraSwitch && support) { GUI.enabled = true; } EditorGUI.indentLevel -= 2; } if (support && VRModule.isSteamVRPluginDetected) { s_guiChanged |= EditorGUI.EndChangeCheck(); } else { GUI.enabled = true; } } if (support && !VRModule.isSteamVRPluginDetected) { EditorGUI.indentLevel += 2; GUILayout.BeginHorizontal(); EditorGUILayout.HelpBox("External-Camera(Mix-Reality), animated controller model, VIVE Controller haptics(vibration)" + #if UNITY_2017_1_OR_NEWER ", VIVE Tracker USB/Pogo-pin input" + #else ", VIVE Tracker device" + #endif " NOT supported! Install SteamVR Plugin to get support.", MessageType.Warning); s_warningHeight = Mathf.Max(s_warningHeight, GUILayoutUtility.GetLastRect().height); if (!VRModule.isSteamVRPluginDetected) { GUILayout.BeginVertical(GUILayout.Height(s_warningHeight)); GUILayout.FlexibleSpace(); ShowUrlLinkButton(URL_STEAM_VR_PLUGIN); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); } GUILayout.EndHorizontal(); EditorGUI.indentLevel -= 2; } }
public override void OnPreferenceGUI() { const string title = "OpenVR"; if (canSupport) { var wasSupported = support; support = m_foldouter.ShowFoldoutButtonOnToggleEnabled(new GUIContent(title, "VIVE, VIVE Pro, VIVE Pro Eye, VIVE Cosmos\nOculus Rift, Oculus Rift S, Windows MR"), wasSupported); s_symbolChanged |= wasSupported != support; } else { GUILayout.BeginHorizontal(); Foldouter.ShowFoldoutBlank(); if (activeBuildTargetGroup != BuildTargetGroup.Standalone) { GUI.enabled = false; ShowToggle(new GUIContent(title, "Standalone platform required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowSwitchPlatformButton(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64); } #if UNITY_2020_2_OR_NEWER && FALSE // openxr not fully supported yet else if (!PackageManagerHelper.IsPackageInList(OPENXR_PLUGIN_PACKAGE_NAME)) { GUI.enabled = false; ShowToggle(new GUIContent(title, "OpenXR Plugin ackage required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowAddPackageButton("OpenXR Plugin", OPENXR_PLUGIN_PACKAGE_NAME); } #elif UNITY_2019_3_OR_NEWER && FALSE // openvr xr plugin on Valve registry is obsolete else if (!PackageManagerHelper.IsPackageInList(OPENVR_XR_PACKAGE_NAME)) { GUI.enabled = false; ShowToggle(new GUIContent(title, "OpenVR XR Plugin package required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); if (GUILayout.Button(new GUIContent("Add OpenVR XR Plugin Package", "Add " + OPENVR_XR_PACKAGE_NAME + " to Package Manager"), GUILayout.ExpandWidth(false))) { if (!ManifestUtils.CheckRegistryExists(ValveRegistry)) { ManifestUtils.AddRegistry(ValveRegistry); } PackageManagerHelper.AddToPackageList(OPENVR_XR_PACKAGE_NAME); VIUProjectSettings.Instance.isInstallingOpenVRXRPlugin = true; } } #elif UNITY_2018_2_OR_NEWER && FALSE // obsolete else if (!PackageManagerHelper.IsPackageInList(OPENVR_PACKAGE_NAME)) { GUI.enabled = false; ShowToggle(new GUIContent(title, "OpenVR (Desktop) package required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowAddPackageButton("OpenVR (Desktop)", OPENVR_PACKAGE_NAME); } #endif else if (!VRModule.isSteamVRPluginDetected) { GUI.enabled = false; ShowToggle(new GUIContent(title, "SteamVR Plugin required."), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowUrlLinkButton(URL_STEAM_VR_PLUGIN); } GUILayout.EndHorizontal(); } if (support && m_foldouter.isExpended) { EditorGUI.indentLevel += 2; // Vive Hand Tracking Submodule const string vhtSdkUrl = "https://developer.vive.com/resources/vive-sense/sdk/vive-hand-tracking-sdk/"; const string vhtTitle = "Enable Vive Hand Tracking"; if (!VRModule.isViveHandTrackingDetected) { GUILayout.BeginHorizontal(); GUI.enabled = false; EditorGUILayout.ToggleLeft(new GUIContent(vhtTitle, "Vive Hand Tracking SDK required"), false, GUILayout.Width(230f)); GUI.enabled = true; GUILayout.FlexibleSpace(); ShowUrlLinkButton(vhtSdkUrl); GUILayout.EndHorizontal(); } else { EditorGUI.BeginChangeCheck(); VRModuleSettings.activateViveHandTrackingSubmodule = EditorGUILayout.ToggleLeft(new GUIContent(vhtTitle, "Works on Vive, VIVE Pro, Vive Pro Eye, VIVE Cosmos, VIVE Cosmos XR and Valve Index"), VRModuleSettings.activateViveHandTrackingSubmodule); s_guiChanged |= EditorGUI.EndChangeCheck(); } if (VRModule.isSteamVRPluginDetected) { EditorGUI.BeginChangeCheck(); } else { GUI.enabled = false; } // Skeleton mode VIUSettings.steamVRLeftSkeletonMode = (SteamVRSkeletonMode)EditorGUILayout.EnumPopup(new GUIContent("Left Controller Skeleton", "This effects RenderModelHook's behaviour"), VIUSettings.steamVRLeftSkeletonMode); VIUSettings.steamVRRightSkeletonMode = (SteamVRSkeletonMode)EditorGUILayout.EnumPopup(new GUIContent("Right Controller Skeleton", "This effects RenderModelHook's behaviour"), VIUSettings.steamVRRightSkeletonMode); VIUSettings.autoLoadExternalCameraConfigOnStart = EditorGUILayout.ToggleLeft(new GUIContent("Load Config and Enable External Camera on Start", "You can also load config by calling ExternalCameraHook.LoadConfigFromFile(path) in script."), VIUSettings.autoLoadExternalCameraConfigOnStart); if (!VIUSettings.autoLoadExternalCameraConfigOnStart) { GUI.enabled = false; } { EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); VIUSettings.externalCameraConfigFilePath = EditorGUILayout.DelayedTextField(new GUIContent("Config Path"), VIUSettings.externalCameraConfigFilePath); if (string.IsNullOrEmpty(VIUSettings.externalCameraConfigFilePath)) { VIUSettings.externalCameraConfigFilePath = VIUSettings.EXTERNAL_CAMERA_CONFIG_FILE_PATH_DEFAULT_VALUE; EditorGUI.EndChangeCheck(); } else if (EditorGUI.EndChangeCheck() && VIUSettings.externalCameraConfigFilePath.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) { VIUSettings.externalCameraConfigFilePath = VIUSettings.EXTERNAL_CAMERA_CONFIG_FILE_PATH_DEFAULT_VALUE; } // Create button that writes default config file if (VIUSettings.autoLoadExternalCameraConfigOnStart && !File.Exists(VIUSettings.externalCameraConfigFilePath)) { if (VRModule.isSteamVRPluginDetected) { s_guiChanged |= EditorGUI.EndChangeCheck(); } ShowCreateExCamCfgButton(); if (VRModule.isSteamVRPluginDetected) { EditorGUI.BeginChangeCheck(); } } EditorGUI.indentLevel--; } if (!VIUSettings.autoLoadExternalCameraConfigOnStart) { GUI.enabled = true; } VIUSettings.enableExternalCameraSwitch = EditorGUILayout.ToggleLeft(new GUIContent("Enable External Camera Switch", VIUSettings.EX_CAM_UI_SWITCH_TOOLTIP), VIUSettings.enableExternalCameraSwitch); if (!VIUSettings.enableExternalCameraSwitch) { GUI.enabled = false; } { EditorGUI.indentLevel++; VIUSettings.externalCameraSwitchKey = (KeyCode)EditorGUILayout.EnumPopup("Switch Key", VIUSettings.externalCameraSwitchKey); VIUSettings.externalCameraSwitchKeyModifier = (KeyCode)EditorGUILayout.EnumPopup("Switch Key Modifier", VIUSettings.externalCameraSwitchKeyModifier); EditorGUI.indentLevel--; } if (!VIUSettings.enableExternalCameraSwitch) { GUI.enabled = true; } EditorGUI.indentLevel -= 2; if (VRModule.isSteamVRPluginDetected) { s_guiChanged |= EditorGUI.EndChangeCheck(); } else { GUI.enabled = true; } } if (support && !VRModule.isSteamVRPluginDetected && !PackageManagerHelper.IsPackageInList(OPENXR_PLUGIN_PACKAGE_NAME)) { EditorGUI.indentLevel += 2; GUILayout.BeginHorizontal(); EditorGUILayout.HelpBox( #if VIU_XR_GENERAL_SETTINGS "Input" + #elif UNITY_2017_1_OR_NEWER "External-Camera(Mix-Reality), animated controller model" + ", VIVE Controller haptics(vibration)" + ", VIVE Tracker USB/Pogo-pin input" + #else "External-Camera(Mix-Reality), animated controller model" + ", VIVE Controller haptics(vibration)" + ", VIVE Tracker device" + #endif " NOT supported! " + "Install SteamVR Plugin to get support." , MessageType.Warning); s_warningHeight = Mathf.Max(s_warningHeight, GUILayoutUtility.GetLastRect().height); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(GUILayout.Height(s_warningHeight)); GUILayout.FlexibleSpace(); ShowUrlLinkButton(URL_STEAM_VR_PLUGIN, "Get SteamVR Plugin"); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); EditorGUI.indentLevel -= 2; } #if UNITY_2019_3_OR_NEWER if (VIUProjectSettings.Instance.isInstallingOpenVRXRPlugin) { bool isPackageInstalled = PackageManagerHelper.IsPackageInList(OPENVR_XR_PACKAGE_NAME) || PackageManagerHelper.IsPackageInList(OPENVR_XR_PACKAGE_NAME_OLD); bool isLoaderEnabled = XRPluginManagementUtils.IsXRLoaderEnabled(SteamVRModule.OPENVR_XR_LOADER_NAME, BuildTargetGroup.Standalone); if (isPackageInstalled && !isLoaderEnabled) { XRPluginManagementUtils.SetXRLoaderEnabled(SteamVRModule.OPENVR_XR_LOADER_CLASS_NAME, BuildTargetGroup.Standalone, true); OpenVRSDK.enabled = true; VIUProjectSettings.Instance.isInstallingOpenVRXRPlugin = false; } } #endif }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); #if !DEBUG App.Tracker.Send(HitBuilder.CreateScreenView("Send").Build()); #endif PersistentDisplay.ActivatePersistentDisplay(); if (Frame.BackStackDepth > 0) { if (Frame.BackStack[Frame.BackStackDepth - 1].SourcePageType == typeof(MainSend)) { Frame.BackStack.RemoveAt(Frame.BackStackDepth - 1); } } var rs = MainPage.Current.GetSelectedSystem(); bool isDestinationAndroid; IRomePackageManager packageManager; if (rs is NormalizedRemoteSystem) { isDestinationAndroid = true; packageManager = MainPage.Current.AndroidPackageManager; var nrs = rs as NormalizedRemoteSystem; if ((!string.IsNullOrEmpty(nrs.AppVersion)) && (Version.TryParse(nrs.AppVersion, out Version remoteAppVersion)) && (remoteAppVersion < new Version("2.1.4"))) { MainPage.Current.AndroidPackageManager.Mode = AndroidRomePackageManager.AndroidPackageManagerMode.MessageCarrier; } else { PackageManagerHelper.InitAndroidPackageManagerMode(); } } else { isDestinationAndroid = false; packageManager = MainPage.Current.PackageManager; } string deviceName = (new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation()).FriendlyName; var mode = e.Parameter.ToString(); if ((mode == "file") && (!(await IsAllowedToSendAsync()))) { ViewModel.SendStatus = ""; await TrialHelper.AskForUpgradeWhileSending(); if (!(await IsAllowedToSendAsync())) { #if !DEBUG App.Tracker.Send(HitBuilder.CreateCustomEvent("Send", "AskedToUpgrade", "Rejected").Build()); #endif PersistentDisplay.ReleasePersistentDisplay(); Frame.GoBack(); return; } #if !DEBUG App.Tracker.Send(HitBuilder.CreateCustomEvent("Send", "AskedToUpgrade", "Accepted").Build()); #endif ViewModel.SendStatus = "Connecting..."; } bool succeed = true; FileTransferResult fileTransferResult = FileTransferResult.Successful; try { if (mode == "launchUri") { await LaunchUri(rs); } else if (mode == "text") { string text = SendDataTemporaryStorage.Text; bool fastSendResult = await TrySendFastClipboard(text, rs, deviceName); if (fastSendResult) { SendTextFinished(""); } else { ViewModel.ProgressPercentIndicatorVisibility = Visibility.Visible; RomeAppServiceConnectionStatus result = await Connect(rs); if (result != RomeAppServiceConnectionStatus.Success) { HideEverything(); succeed = false; string errorMessage; if ((result == RomeAppServiceConnectionStatus.RemoteSystemUnavailable) && (packageManager is AndroidRomePackageManager)) { errorMessage = "Can't connect to device. Open Roamit on your Android device and then try again."; } else { errorMessage = result.ToString(); } await(new MessageDialog(errorMessage, "Can't connect")).ShowAsync(); Frame.GoBack(); return; } ViewModel.UnlockNoticeVisibility = Visibility.Collapsed; await SendText(packageManager, deviceName, text); } } else if (mode == "file") { ViewModel.ProgressPercentIndicatorVisibility = Visibility.Visible; RomeAppServiceConnectionStatus result = await Connect(rs); if (result != RomeAppServiceConnectionStatus.Success) { HideEverything(); succeed = false; string errorMessage; if ((result == RomeAppServiceConnectionStatus.RemoteSystemUnavailable) && (packageManager is AndroidRomePackageManager)) { errorMessage = "Can't connect to device. Open Roamit on your Android device and then try again."; } else { errorMessage = result.ToString(); } await(new MessageDialog(errorMessage, "Can't connect")).ShowAsync(); Frame.GoBack(); return; } ViewModel.UnlockNoticeVisibility = Visibility.Collapsed; if (!isDestinationAndroid) { ViewModel.LeaveScreenOnNoticeVisibility = Visibility.Visible; } fileTransferResult = await SendFile(rs, packageManager, deviceName); if (fileTransferResult != FileTransferResult.Successful) { HideEverything(); succeed = false; Frame.GoBack(); return; } if (!isDestinationAndroid) { ViewModel.LeaveScreenOnNoticeVisibility = Visibility.Collapsed; } } else { succeed = false; await(new MessageDialog("MainSend::Invalid parameter.")).ShowAsync(); Frame.GoBack(); return; } } finally { PersistentDisplay.ReleasePersistentDisplay(); #if !DEBUG if (rs is NormalizedRemoteSystem) { App.Tracker.Send(HitBuilder.CreateCustomEvent("SendToAndroid", mode, succeed ? "Success" : ((mode == "file") ? fileTransferResult.ToString() : "Failed")).Build()); } else { App.Tracker.Send(HitBuilder.CreateCustomEvent("SendToWindows", mode, succeed ? "Success" : ((mode == "file") ? fileTransferResult.ToString() : "Failed")).Build()); } #endif sendingFile = false; } if (SendDataTemporaryStorage.IsSharingTarget) { if (App.ShareOperation == null) { #if !DEBUG App.Tracker.Send(HitBuilder.CreateCustomEvent("Send", "UriTarget").Build()); #endif await Task.Delay(TimeSpan.FromSeconds(1.5)); App.Current.Exit(); } else { #if !DEBUG App.Tracker.Send(HitBuilder.CreateCustomEvent("Send", "ShareTarget").Build()); #endif await Task.Delay(TimeSpan.FromSeconds(1.5)); App.ShareOperation.ReportCompleted(); } SendDataTemporaryStorage.IsSharingTarget = false; App.ShareOperation = null; } else { ViewModel.GoBackButtonVisibility = Visibility.Visible; GoBackButtonShowStoryboard.Begin(); if (succeed) { await AskForReviewIfNecessary(); } #if !DEBUG App.Tracker.Send(HitBuilder.CreateCustomEvent("Send", "WithinApp").Build()); #endif } }