private async void Launch_Clicked(object sender, RoutedEventArgs e) { RemoteSystem selectedSystem = SystemListComboBox.SelectedItem as RemoteSystem; if (selectedSystem != null) { Uri uri; if (Uri.TryCreate(UriTextBox.Text, UriKind.Absolute, out uri)) { UpdateStatus("LaunchUriAsync called. Waiting for response...", NotifyType.StatusMessage); // Launch URI on the remote system. // Note: LaunchUriAsync needs to called from the UI thread. RemoteLaunchUriStatus launchUriStatus = await RemoteLauncher.LaunchUriAsync(new RemoteSystemConnectionRequest(selectedSystem), uri); UpdateStatus("LaunchUriStatus = " + launchUriStatus.ToString(), launchUriStatus == RemoteLaunchUriStatus.Success ? NotifyType.StatusMessage : NotifyType.ErrorMessage); } else { UpdateStatus("Please enter a valid URI.", NotifyType.ErrorMessage); } } else { UpdateStatus("Please select a system.", NotifyType.ErrorMessage); } }
// Summary: // Check if the device is connected, if not send a request to launch the application on the remote device public virtual async System.Threading.Tasks.Task <bool> CheckCompanionDeviceConnected(CompanionDevice cd) { if ((listCompanionDevices.ContainsKey(cd.Id)) && (listRemoteSystems.ContainsKey(cd.Id))) { if (listCompanionDevices[cd.Id].Status != CompanionDeviceStatus.Connected) { RemoteSystemConnectionRequest rscr = new RemoteSystemConnectionRequest(listRemoteSystems[cd.Id]); if (rscr != null) { Uri uri; if (Uri.TryCreate(ApplicationUri, UriKind.Absolute, out uri)) { RemoteLaunchUriStatus launchUriStatus = await Windows.System.RemoteLauncher.LaunchUriAsync(rscr, uri); if (launchUriStatus == RemoteLaunchUriStatus.Success) { listCompanionDevices[cd.Id].Status = CompanionDeviceStatus.Connected; } } } } if (listCompanionDevices[cd.Id].Status == CompanionDeviceStatus.Connected) { return(true); } } return(false); }
private async void button_Click(object sender, RoutedEventArgs e) { // <SnippetRemoteUriLaunch> if (m_deviceList.Count > 0) { RemoteSystem SelectedDevice = m_deviceList[0]; RemoteLaunchUriStatus launchUriStatus = await RemoteLauncher.LaunchUriAsync( new RemoteSystemConnectionRequest(SelectedDevice), new Uri("bingmaps:?cp=47.6204~-122.3491&sty=3d&rad=200&pit=75&hdg=165")); } // </SnippetRemoteUriLaunch> }
public async Task LaunchOnSystem(RemoteSystem system) { BrowserPageViewModel browserVM = SimpleIoc.Default.GetInstance <BrowserPageViewModel>(); string collectionJson = "{}"; if (browserVM.Images is IJsonizable) { collectionJson = (browserVM.Images as IJsonizable).toJson(); } ValueSet values = new ValueSet(); values["images"] = collectionJson; values["index"] = browserVM.FlipViewIndex; RemoteLauncherOptions option = new RemoteLauncherOptions(); option.FallbackUri = new Uri("https://www.microsoft.com/store/p/monocle-giraffe/9nblggh4qcvh"); RemoteLaunchUriStatus launchUriStatus = await RemoteLauncher.LaunchUriAsync(new RemoteSystemConnectionRequest(system), new Uri($"imgur:?images={collectionJson}&index={browserVM.FlipViewIndex}&type={browserVM.Images.GetType().Name}")); }
public static RomeRemoteLaunchUriStatus ConvertToRomeRemoteLaunchUriStatus(this RemoteLaunchUriStatus launchUriStatus) { if (launchUriStatus.Value == RemoteLaunchUriStatus.AppUnavailable.Value) { return(RomeRemoteLaunchUriStatus.AppUnavailable); } else if (launchUriStatus.Value == RemoteLaunchUriStatus.DeniedByLocalSystem.Value) { return(RomeRemoteLaunchUriStatus.DeniedByLocalSystem); } else if (launchUriStatus.Value == RemoteLaunchUriStatus.DeniedByRemoteSystem.Value) { return(RomeRemoteLaunchUriStatus.DeniedByRemoteSystem); } else if (launchUriStatus.Value == RemoteLaunchUriStatus.ProtocolUnavailable.Value) { return(RomeRemoteLaunchUriStatus.ProtocolUnavailable); } else if (launchUriStatus.Value == RemoteLaunchUriStatus.RemoteSystemUnavailable.Value) { return(RomeRemoteLaunchUriStatus.RemoteSystemUnavailable); } else if (launchUriStatus.Value == RemoteLaunchUriStatus.Success.Value) { return(RomeRemoteLaunchUriStatus.Success); } else if (launchUriStatus.Value == RemoteLaunchUriStatus.Unknown.Value) { return(RomeRemoteLaunchUriStatus.Unknown); } else if (launchUriStatus.Value == RemoteLaunchUriStatus.BundleTooLarge.Value) { return(RomeRemoteLaunchUriStatus.ValueSetTooLarge); } else { return(RomeRemoteLaunchUriStatus.Unknown); } }
private async void selectFromList(object sender, SelectionChangedEventArgs e) { RemoteSystem selection = ((sender as ListBox).SelectedItem as RemoteSystem); if (selection != null) { /** * * Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder; * Windows.Storage.StorageFile sampleFile = * await storageFolder.CreateFileAsync("helloworld.pdf", * Windows.Storage.CreationCollisionOption.ReplaceExisting); * * sampleFile = await storageFolder.GetFileAsync("helloworld.pdf"); * await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Hello World"); * // var success = await Windows.System.Launcher.LaunchFileAsync(sampleFile); * //after the device is selected, create a new session for particpants to join * Debug.WriteLine(sampleFile.Path); * var uri = new System.Uri(sampleFile.Path); * var converted = uri.AbsoluteUri; * * Windows.System.LauncherOptions options = new Windows.System.LauncherOptions(); * options.ContentType = "application/pdf"; * Windows.System.Launcher.LaunchUriAsync(new Uri(sampleFile.Path), options); **/ RemoteLaunchUriStatus launchURIstatus = await RemoteLauncher.LaunchUriAsync( new RemoteSystemConnectionRequest(selection), new Uri($"ms-chat:?Body={"Hello World"}")); // Debug.WriteLine(uri.AbsoluteUri); Debug.WriteLine("3"); //await CreateSession(selection); //StartRecievingMessages(); //rmeote system connection request //RemoteSystemConnectionRequest connRequest = new RemoteSystemConnectionRequest(selection); } }
public void OnCompleted(RemoteLaunchUriStatus p0) { LaunchCompleted?.Invoke(p0); }
public async Task <RomeRemoteLaunchUriStatus> LaunchUri(Uri uri, object remoteSystemOverride) { RemoteSystem rs = remoteSystem as RemoteSystem; if (remoteSystemOverride != null) { rs = remoteSystemOverride as RemoteSystem; if (rs == null) { throw new InvalidCastException(); } } RemoteLaunchUriStatus launchStatus = RemoteLaunchUriStatus.RemoteSystemUnavailable; bool workDone = false; int tryCount = getTryCount(); for (int i = 0; i < tryCount; i++) { Task launch = Common.DispatcherEx.RunOnCoreDispatcherIfPossible(async() => { /*var options = new Windows.System.RemoteLauncherOptions() * { * FallbackUri = new Uri(@"http://google.com") * };*/ RemoteSystemConnectionRequest req = connectionRequest; if (rs != null) { req = new RemoteSystemConnectionRequest(rs); } launchStatus = await Windows.System.RemoteLauncher.LaunchUriAsync(req, uri /*, options*/); workDone = true; }, false); Task delay = SetTimeoutTask(remoteSystem ?? rs, i); await Task.WhenAny(new Task[] { launch, delay }); if (workDone) { break; } else { System.Diagnostics.Debug.WriteLine("Launch timeout"); if (i >= 2) { await ReconnectIfEnabled(); } } } if (launchStatus == RemoteLaunchUriStatus.ProtocolUnavailable) { await LaunchStoreForApp(rs); } return((RomeRemoteLaunchUriStatus)launchStatus); }