public AppServiceClientConnection( string appServiceName, string appIdentifier, RemoteSystemConnectionRequest request) : this(appServiceName, appIdentifier, request, GetAppServiceClientConnectionListener(), GetAppServiceResponseListener()) { }
private async Task <bool> InitializeAppService() { try { _appService = new AppServiceConnection() { AppServiceName = "com.adventure", PackageFamilyName = Windows.ApplicationModel.Package.Current.Id.FamilyName }; RemoteSystemConnectionRequest connectionRequest = new RemoteSystemConnectionRequest(RemoteSystem); var status = await _appService.OpenRemoteAsync(connectionRequest).AsTask().ConfigureAwait(false); if (status == AppServiceConnectionStatus.Success) { _appService.RequestReceived += AppService_RequestReceived; _appService.ServiceClosed += AppService_ServiceClosed; } else { CleanUpAppService(); } return(status == AppServiceConnectionStatus.Success); } catch (Exception) {} return(false); }
private async Task ConnectToRemoteAppServiceAsync() { RemoteSystem selectedDevice = DeviceListComboBox.SelectedItem as RemoteSystem; if (selectedDevice != null) { // Create a remote system connection request. RemoteSystemConnectionRequest connectionRequest = new RemoteSystemConnectionRequest(selectedDevice); // Set up a new app service connection. The following app service name and package family name // are used in this sample to work with AppServices provider SDK sample on a remote system. using (AppServiceConnection connection = new AppServiceConnection { AppServiceName = "com.microsoft.randomnumbergenerator", PackageFamilyName = "Microsoft.SDKSamples.AppServicesProvider.CS_8wekyb3d8bbwe" }) { UpdateStatus("Opening connection to remote app service...", NotifyType.StatusMessage); AppServiceConnectionStatus status = await connection.OpenRemoteAsync(connectionRequest); if (status == AppServiceConnectionStatus.Success) { UpdateStatus("Successfully connected to remote app service.", NotifyType.StatusMessage); await SendMessageToRemoteAppServiceAsync(connection); } else { UpdateStatus("Attempt to open a remote app service connection failed with error - " + status.ToString(), NotifyType.ErrorMessage); } } } else { UpdateStatus("Select a device for remote connection.", NotifyType.ErrorMessage); } }
public async Task <RomeRemoteLaunchUriStatus> LaunchUri(Uri uri, object remoteSystemOverride) { RemoteSystem rs = null; if (remoteSystemOverride != null) { rs = remoteSystemOverride as RemoteSystem; if (rs == null) { throw new InvalidCastException(); } } var request = new RemoteSystemConnectionRequest(rs); var launchUriStatus = await RemoteLauncher.LaunchUriAsync(request, uri); var result = launchUriStatus.ConvertToRomeRemoteLaunchUriStatus(); if (result == RomeRemoteLaunchUriStatus.ProtocolUnavailable) { await LaunchStoreForApp(rs); } return(result); }
// 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 RemoteActivated(object sender, RoutedEventArgs e) { var fw = sender as FrameworkElement; if (fw == null) { return; } var remote = fw.DataContext as RemoteSystem; if (remote == null) { return; } var res = await RemoteSystem.RequestAccessAsync(); if (res != RemoteSystemAccessStatus.Allowed) { return; } bool isRemoteSystemLaunchUriCapable = await remote.GetCapabilitySupportedAsync(KnownRemoteSystemCapabilities.LaunchUri); bool isRemoteSystemAppServiceCapable = await remote.GetCapabilitySupportedAsync(KnownRemoteSystemCapabilities.AppService); bool isRemoteSystemRemoteSessionCapable = await remote.GetCapabilitySupportedAsync(KnownRemoteSystemCapabilities.RemoteSession); bool isRemoteSystemSpatialEntityCapable = await remote.GetCapabilitySupportedAsync(KnownRemoteSystemCapabilities.SpatialEntity); var rscr = new RemoteSystemConnectionRequest(remote); var uri = new Uri("http://www.google.co.uk"); var status = await RemoteLauncher.LaunchUriAsync(rscr, uri); }
public async static Task <AdventureRemoteSystem> CreateAdventureRemoteSystem(RemoteSystem system) { if (system == null) { return(null); } var appService = new AppServiceConnection() { AppServiceName = "com.adventure", PackageFamilyName = Windows.ApplicationModel.Package.Current.Id.FamilyName }; RemoteSystemConnectionRequest connectionRequest = new RemoteSystemConnectionRequest(system); var status = await appService.OpenRemoteAsync(connectionRequest); if (status != AppServiceConnectionStatus.Success) { return(null); } var message = new ValueSet(); message.Add("ping", ""); var response = await appService.SendMessageAsync(message).AsTask().ConfigureAwait(false); if (response.Status != AppServiceResponseStatus.Success) { return(null); } return(new AdventureRemoteSystem(system, appService)); }
private void Initialize(string appServiceName, string packageFamilyName) { appService = new AppServiceConnection() { AppServiceName = appServiceName, PackageFamilyName = packageFamilyName }; connectionRequest = null; }
public async Task <RomeAppServiceConnectionStatus> Connect(object _remoteSystem, bool keepAlive, Uri wakeUri) { var rs = _remoteSystem as RemoteSystem; if (rs == null) { throw new InvalidCastException(); } remoteSystem = rs; if ((wakeUri != null) && (!rs.IsAvailableByProximity) && (rs.Kind.Value == RemoteSystemKinds.Phone.Value)) { //Wake device first var wakeResult = await LaunchUri(wakeUri, rs); if (wakeResult == RomeRemoteLaunchUriStatus.Success) { RemoteSystem rsNew = await RediscoverRemoteSystem(rs); System.Diagnostics.Debug.WriteLine(rsNew.IsAvailableByProximity); if (rsNew == null) { return(RomeAppServiceConnectionStatus.RemoteSystemUnavailable); } else { rs = rsNew; } } } try { if (sendSemaphore.CurrentCount == 0) { sendSemaphore.Release(); } } catch { } connectionRequest = new RemoteSystemConnectionRequest(rs); appService = new AppServiceClientConnection(appServiceName, appIdentifier, connectionRequest); var result = await appService.OpenRemoteAsync(); var finalResult = result.ConvertToRomeAppServiceConnectionStatus(); if (finalResult == RomeAppServiceConnectionStatus.AppNotInstalled) { await LaunchStoreForApp(_remoteSystem); } return(finalResult); }
private async Task <RemoteLaunchUriStatus> LaunchAppOnDeviceAsync(RemoteSystem device, string args) { if (!IsSupported) { return(RemoteLaunchUriStatus.Unknown); } RemoteSystemConnectionRequest request = new RemoteSystemConnectionRequest(device); return(await RemoteLauncher.LaunchUriAsync(request, new Uri("nep:" + args))); }
// This method returns an open connection to a particular app service on a remote system. // param "remotesys" is a RemoteSystem object representing the device to connect to. public async Task <ValueSet> RequestRemoteResponseAsync(ValueSet querys, bool rollOver = false) { if (m_deviceList.Count == 0) { return(null); } // Set up a new app service connection. The app service name and package family name that // are used here correspond to the AppServices UWP sample. var connection = new AppServiceConnection { AppServiceName = Consts.ProjectRomeService, PackageFamilyName = Consts.PackageFamilyName }; foreach (var remotesys in m_deviceList) { // a valid RemoteSystem object is needed before going any further if (remotesys == null) { continue; } // Create a remote system connection request for the given remote device var connectionRequest = new RemoteSystemConnectionRequest(remotesys); // "open" the AppServiceConnection using the remote request var status = await connection.OpenRemoteAsync(connectionRequest); // only continue if the connection opened successfully if (status != AppServiceConnectionStatus.Success) { continue; } // send input and receive output in a variable var response = await connection.SendMessageAsync(querys); // check that the service successfully received and processed the message if (response.Status == AppServiceResponseStatus.Success) { if (!rollOver) { // Get the data that the service returned: return(response.Message); } else { continue; } } } return(null); }
//<SnippetAppService> // This method returns an open connection to a particular app service on a remote system. // param "remotesys" is a RemoteSystem object representing the device to connect to. private async void openRemoteConnectionAsync(RemoteSystem remotesys) { // Set up a new app service connection. The app service name and package family name that // are used here correspond to the AppServices UWP sample. AppServiceConnection connection = new AppServiceConnection { AppServiceName = "com.microsoft.randomnumbergenerator", PackageFamilyName = "Microsoft.SDKSamples.AppServicesProvider.CS_8wekyb3d8bbwe" }; //</SnippetAppService> //<SnippetRemoteConnection> // a valid RemoteSystem object is needed before going any further if (remotesys == null) { return; } // Create a remote system connection request for the given remote device RemoteSystemConnectionRequest connectionRequest = new RemoteSystemConnectionRequest(remotesys); // "open" the AppServiceConnection using the remote request AppServiceConnectionStatus status = await connection.OpenRemoteAsync(connectionRequest); // only continue if the connection opened successfully if (status != AppServiceConnectionStatus.Success) { return; } //</SnippetRemoteConnection> //<SnippetSendMessage> // create the command input ValueSet inputs = new ValueSet(); // min_value and max_value vars are obtained somewhere else in the program inputs.Add("minvalue", min_value); inputs.Add("maxvalue", max_value); // send input and receive output in a variable AppServiceResponse response = await connection.SendMessageAsync(inputs); string result = ""; // check that the service successfully received and processed the message if (response.Status == AppServiceResponseStatus.Success) { // Get the data that the service returned: result = response.Message["Result"] as string; } }
public virtual async Task OpenConnectionRemotelyAsync(RemoteSystem remoteSystem) { if (!ConnectionAlive) { var connectionRequest = new RemoteSystemConnectionRequest(remoteSystem); AppServiceConnectionStatus status = await Connection.OpenRemoteAsync(connectionRequest); if (status == AppServiceConnectionStatus.Success) { ConnectionAlive = true; } } }
public virtual async System.Threading.Tasks.Task <bool> Send(CompanionDevice cd, string Message) { if (cd != null) { if (await CheckCompanionDeviceConnected(cd)) { if (listRemoteSystems.ContainsKey(cd.Id)) { RemoteSystemConnectionRequest rscr = new RemoteSystemConnectionRequest(listRemoteSystems[cd.Id]); if (rscr != null) { using (var connection = new AppServiceConnection()) { //Set up a new app service connection connection.AppServiceName = AppServiceName; connection.PackageFamilyName = PackageFamilyName; AppServiceConnectionStatus status = await connection.OpenRemoteAsync(rscr); if (status == AppServiceConnectionStatus.Success) { //Set up the inputs and send a message to the service var inputs = new ValueSet(); inputs.Add(CompanionServiceMessage.ATT_TYPE, CompanionServiceMessage.TYPE_DATA); inputs.Add(CompanionServiceMessage.ATT_SOURCEID, GetSourceId()); inputs.Add(CompanionServiceMessage.ATT_SOURCENAME, GetSourceName()); inputs.Add(CompanionServiceMessage.ATT_SOURCEIP, GetSourceIP()); inputs.Add(CompanionServiceMessage.ATT_SOURCEKIND, GetSourceKind()); inputs.Add(CompanionServiceMessage.ATT_MESSAGE, Message); AppServiceResponse response = await connection.SendMessageAsync(inputs); if ((response != null) && (response.Status == AppServiceResponseStatus.Success)) { if ((response.Message != null) && (response.Message.ContainsKey(CompanionServiceMessage.ATT_TYPE))) { string s = (string)response.Message[CompanionServiceMessage.ATT_TYPE]; if (string.Equals(s, CompanionServiceMessage.TYPE_RESULT)) { return(true); } } } } } } } } } return(false); }
public async void OnInvokeRemoteSystemByUriAsync(object sender, RoutedEventArgs e) { if (currentRemoteSystem == null) { return; } // 檢查設備是否支援需要的特性 //await currentRemoteSystem.GetCapabilitySupportedAsync(KnownRemoteSystemCapabilities.LaunchUri) var launchRequest = new RemoteSystemConnectionRequest(currentRemoteSystem); var result = await RemoteLauncher.LaunchUriAsync(launchRequest, new Uri("https://poumason.blogspot.com")); Debug.WriteLine(result.ToString()); }
public async Task LaunchUriAsync() { using (await _launchUriAsyncLock.LockAsync()) { LaunchRemoteUriResult = string.Empty; var target = SelectedRemoteSystem; if (target == null) { LaunchRemoteUriResult = "Il faut sélectionner une cible..."; return; } if (!string.IsNullOrEmpty(TargetLaunchHost)) { // construct a HostName object Windows.Networking.HostName deviceHost = new Windows.Networking.HostName(TargetLaunchHost); // create a RemoteSystem object with the HostName var remotesys = await RemoteSystem.FindByHostNameAsync(deviceHost); if (remotesys != null) { LaunchRemoteUriResult = "Cible trouvée"; target = remotesys; } } var targetRs = RemoteSystems .FirstOrDefault(r => r.Status == RemoteSystemStatus.Available); var request = new RemoteSystemConnectionRequest(targetRs); var uri = new Uri(TargetLaunchUri); var launchUriTask = RemoteLauncher.LaunchUriAsync(request, uri); LaunchRemoteUriResult = "Appel en cours..."; var timeout = Task.Delay(13000); await Task.WhenAny(timeout, launchUriTask.AsTask()); if (timeout.IsCompleted) { LaunchRemoteUriResult = "Timeout.... "; } else { var result = await launchUriTask; LaunchRemoteUriResult = "Appel effectué : " + result; } } }
internal async void OnTransfer() { var errorString = string.Empty; this.IsTransferring = true; this.TransferStatus = "connecting..."; using (var connection = new AppServiceConnection()) { connection.PackageFamilyName = App.PackageFamilyName; connection.AppServiceName = App.AppServiceName; var remoteRequest = new RemoteSystemConnectionRequest(this.SelectedRemoteSystem); var result = await connection.OpenRemoteAsync(remoteRequest); if (result == AppServiceConnectionStatus.Success) { this.TransferStatus = "Connected, calling..."; var message = new ValueSet(); var content = this.Serialize(); message[App.AppServiceParameterKey] = content; var response = await connection.SendMessageAsync(message); if (response.Status != AppServiceResponseStatus.Success) { this.TransferStatus = $"Failed to call - status was [{response.Status}]"; } this.TransferStatus = "Succeeded"; } else { this.TransferStatus = $"Failed to open connection with status {result}"; } this.transferStatus = "Closing"; } // time for the display of errors etc. to be seen. await Task.Delay(2000); this.IsTransferring = false; }
public static Task <RemoteLaunchUriStatus> LaunchUriAsync(RemoteSystemConnectionRequest connectionRequest, Uri uri) { var tcs = new TaskCompletionSource <RemoteLaunchUriStatus>(); try { var launchUriListener = new LaunchURIListener(); launchUriListener.LaunchCompleted += (r) => { tcs.TrySetResult(r); }; RemoteLauncher.LaunchUriAsync(connectionRequest, SystemUriToAndroidUri(uri), launchUriListener); } catch (Exception e) { tcs.TrySetException(e); } return(tcs.Task); }
public static async void CreateAppService(RemoteSystem remoteSystem) { AppServiceConnection connection = new AppServiceConnection(); connection.AppServiceName = "com.microsoft.test.cdppingpongservice"; connection.PackageFamilyName = Package.Current.Id.FamilyName; RemoteSystemConnectionRequest connectionRequest = new RemoteSystemConnectionRequest(remoteSystem); var status = await connection.OpenRemoteAsync(connectionRequest); if (SuccessfulAppServiceClientConnectionStatus(status, connection, remoteSystem) == true) { connection.RequestReceived += PingPongConnection.OnRequestReceived; NotifyAppServiceConnected(connection); } else { DebugWrite($"Failed to create app service connection to ({remoteSystem.DisplayName}, {remoteSystem.Id})"); } }
private static async Task <AppServiceConnectionStatus> OpenAppServiceConnectionAsync(RemoteSystem remoteSystem) { //Connect App Service var connectionRequest = new RemoteSystemConnectionRequest(remoteSystem); if (_appServiceConnection == null) { _appServiceConnection = new AppServiceConnection() { AppServiceName = "com.project-rome.echo", PackageFamilyName = Package.Current.Id.FamilyName }; _appServiceConnection.ServiceClosed += async(sender, args) => { StatusWrite("AppServiceConnection closed to: " + remoteSystem.DisplayName + ", reason: " + args.Status); if (--_connectionRetryCount > 0) { await OpenAppServiceConnectionAsync(remoteSystem); } }; var status = await _appServiceConnection.OpenRemoteAsync(connectionRequest); if (status != AppServiceConnectionStatus.Success) { StatusWrite("Error: " + status); _appServiceConnection = null; } StatusWrite("AppServiceConnection opened to: " + remoteSystem.DisplayName); _connectionRetryCount = 5; return(status); } return(AppServiceConnectionStatus.Success); }
public static async Task LaunchRemoteUriAsync(RemoteSystem remoteSystem, Uri uri) { if (remoteSystem != null) { var connection = new RemoteSystemConnectionRequest(remoteSystem); Events.TrackEvent(Events.LaunchUriAsyncStart); var result = await RemoteLauncher.LaunchUriAsync(connection, uri); if (result == RemoteLaunchUriStatus.Success) { Events.TrackEvent(Events.LaunchUriAsyncSuccess); } switch (result) { case RemoteLaunchUriStatus.Success: Events.TrackEvent(Events.LaunchUriAsyncSuccess); break; case RemoteLaunchUriStatus.DeniedByRemoteSystem: Events.TrackEvent(Events.LaunchUriAsyncErrorDeniedByRemoteSystem); break; case RemoteLaunchUriStatus.ProtocolUnavailable: Events.TrackEvent(Events.LaunchUriAsyncErrorProtocolUnavailable); break; case RemoteLaunchUriStatus.RemoteSystemUnavailable: Events.TrackEvent(Events.LaunchUriAsyncErrorRemoteSystemUnavailable); break; default: Events.TrackEvent(Events.LaunchUriAsyncErrorOther); break; } } }
private async Task ConnectToRemoteAppServiceAsync() { RemoteSystem selectedDevice = DeviceListComboBox.SelectedItem as RemoteSystem; if (selectedDevice != null) { // Create a remote system connection request. RemoteSystemConnectionRequest connectionRequest = new RemoteSystemConnectionRequest(selectedDevice); // Set up a new app service connection. The following app service name and package family name // are used in this sample to work with AppServices provider SDK sample on a remote system. using (AppServiceConnection connection = new AppServiceConnection { AppServiceName = "com.microsoft.randomnumbergenerator", PackageFamilyName = "Microsoft.SDKSamples.AppServicesProvider.CS_8wekyb3d8bbwe" }) { UpdateStatus("Opening connection to remote app service...", NotifyType.StatusMessage); AppServiceConnectionStatus status = await connection.OpenRemoteAsync(connectionRequest); if (status == AppServiceConnectionStatus.Success) { UpdateStatus("Successfully connected to remote app service.", NotifyType.StatusMessage); await SendMessageToRemoteAppServiceAsync(connection); } else { UpdateStatus("Attempt to open a remote app service connection failed with error - " + status.ToString(), NotifyType.ErrorMessage); } } } else { UpdateStatus("Select a device for remote connection.", NotifyType.ErrorMessage); } }
public async void OnInvokeRemoteSystemByAppServiceAsync(object sender, RoutedEventArgs e) { if (currentRemoteSystem == null) { return; } // 檢查設備是否支援需要的特性 if (await currentRemoteSystem.GetCapabilitySupportedAsync(KnownRemoteSystemCapabilities.AppService)) { AppServiceConnection connection = new AppServiceConnection(); connection.AppServiceName = "com.pou.MyApService"; connection.PackageFamilyName = "f9842749-e4c8-4c15-bac8-bc018db1b2ea_s1mb6h805jdtj"; RemoteSystemConnectionRequest appServiceRequest = new RemoteSystemConnectionRequest(currentRemoteSystem); AppServiceConnectionStatus status = await connection.OpenRemoteAsync(appServiceRequest); if (status == AppServiceConnectionStatus.Success) { var message = new ValueSet(); message.Add("cmd", "Query"); message.Add("id", "1234"); AppServiceResponse response = await connection.SendMessageAsync(message); if (response.Status == AppServiceResponseStatus.Success) { if (response.Message["status"] as string == "OK") { Debug.WriteLine(response.Message["name"] as string); } } } } }
public AppServiceConnection(string appServiceName, string appIdentifier, RemoteSystemConnectionRequest request) { appServiceConnection = new AppServiceConnectionInternal(appServiceName, appIdentifier, request, GetAppServiceConnectionListener(), GetAppServiceRequestListener(this)); }
public async Task LauncAppServiceAsync(object sender, ItemClickEventArgs e) { using (await _launchAppServiceAsyncLock.LockAsync()) { LaunchRemoteAppServiceResult = string.Empty; var target = SelectedRemoteSystem; if (target == null) { LaunchRemoteAppServiceResult = "Il faut sélectionner une cible..."; return; } // Création d'une reqûete var connectionRequest = new RemoteSystemConnectionRequest(target); // création d'une connexion var connection = new AppServiceConnection { AppServiceName = "com.infinitesquare.CustomRain", PackageFamilyName = Package.Current.Id.FamilyName }; // ouverture de la connexion var openRemoteTask = connection.OpenRemoteAsync(connectionRequest); LaunchRemoteAppServiceResult = "Connexion en cours..."; var timeout = Task.Delay(13000); await Task.WhenAny(timeout, openRemoteTask.AsTask()); if (timeout.IsCompleted) { LaunchRemoteAppServiceResult = "Timeout..."; return; } var result = await openRemoteTask; if (result == AppServiceConnectionStatus.Success) { LaunchRemoteAppServiceResult = "Connecté, envoi du message"; var inputs = new ValueSet(); // min_value and max_value vars are obtained somewhere else in the program inputs.Add("targetUri", e.ClickedItem.ToString()); // send input and receive output in a variable var response = await connection.SendMessageAsync(inputs); if (response.Status != AppServiceResponseStatus.Success) { LaunchRemoteAppServiceResult = "Message envoyé "; } else { LaunchRemoteAppServiceResult = "Echec de l'envoi : " + result; } } else { LaunchRemoteAppServiceResult = "Echec de connexion : " + result; } } }
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); }
public static async Task <RemoteLaunchUriStatus> TrySharetext(RemoteSystem device, string text) { RemoteSystemConnectionRequest connectionRequest = new RemoteSystemConnectionRequest(device); return(await RemoteLauncher.LaunchUriAsync(connectionRequest, new Uri("share-app:?Text=" + Uri.EscapeDataString(text)))); }
public static async Task <RemoteLaunchUriStatus> TryShareURL(RemoteSystem device, string url) { RemoteSystemConnectionRequest connectionRequest = new RemoteSystemConnectionRequest(device); return(await RemoteLauncher.LaunchUriAsync(connectionRequest, new Uri(url))); }
public static async Task <RemoteLaunchUriStatus> TryOpenStoreToApp(RemoteSystem device, String appTarget) { RemoteSystemConnectionRequest connectionRequest = new RemoteSystemConnectionRequest(device); return(await RemoteLauncher.LaunchUriAsync(connectionRequest, new Uri(appTarget))); }
public static async Task <RemoteLaunchUriStatus> TryBeginShareFile(RemoteSystem device, string fileName, string ipAddress) { RemoteSystemConnectionRequest connectionRequest = new RemoteSystemConnectionRequest(device); return(await RemoteLauncher.LaunchUriAsync(connectionRequest, new Uri("share-app:?FileName=" + fileName + "&IpAddress=" + ipAddress))); }
private async void ConnectAppService(string appService, string appIdentifier, RemoteSystemConnectionRequest connectionRequest) { this.appServiceConnection = new AppServiceConnection(appService, appIdentifier, connectionRequest); this.appServiceConnection.RequestReceived += AppServiceConnectionRequestReceived; this.id = connectionRequest.RemoteSystem.Id; try { this.LogMessage("Sending AppServices connection request. Waiting for connection response"); var status = await this.appServiceConnection.OpenRemoteAsync(); if (status == AppServiceConnectionStatus.Success) { this.LogMessage("App Service connection successful!"); this.pingBtn.Enabled = true; } else { this.LogMessage("App Service connection failed, returning status " + status.ToString()); } } catch (ConnectedDevicesException e) { Console.WriteLine("Failed during attempt to create AppServices connection"); e.PrintStackTrace(); } }