public async void OpenLinkInBrowser(string url) { this.NotifyEvent(this, new MyEventArgs("Opening in remote browser...", messageType.Indefinite, false)); this.startTimer(); var status = await RemoteLaunch.TryShareURL(this.remoteSystem, url); this.stopTimer(); if (status == RemoteLaunchUriStatus.Success) { this.NotifyEvent(this, new MyEventArgs(status.ToString(), messageType.Timed, false)); } else { this.NotifyEvent(this, new MyEventArgs(status.ToString(), messageType.Indefinite, false)); } }
public async void sendFile() { var icp = NetworkInformation.GetInternetConnectionProfile(); if (icp?.NetworkAdapter == null) { return; } var hostnames = NetworkInformation.GetHostNames(); HostName hostname = null; foreach (var name in hostnames) { if (name.IPInformation?.NetworkAdapter != null && name.IPInformation.NetworkAdapter.NetworkAdapterId == icp.NetworkAdapter.NetworkAdapterId) { hostname = name; break; } } this.NotifyEvent(this, new MyEventArgs("Launching app on device....", messageType.Indefinite, false)); var status = await RemoteLaunch.TryBeginShareFile(this.RemoteSystem, this.FileToSend.Name, hostname?.CanonicalName); if (status == RemoteLaunchUriStatus.ProtocolUnavailable) { await this.OpenStore(); return; } this.NotifyEvent(this, new MyEventArgs("Waiting for connection....", messageType.Indefinite, false)); //Create a StreamSocketListener to start listening for TCP connections. if (this.socketListener != null) { this.socketListener.Dispose(); } this.socketListener = new StreamSocketListener(); //Hook up an event handler to call when connections are received. socketListener.ConnectionReceived += SocketListener_ConnectionReceived; //Start listening for incoming TCP connections on the specified port. You can specify any port that' s not currently in use. await socketListener.BindServiceNameAsync(this.PortNumber); }
public async void OpenLinkInMyTube(string url) { this.NotifyEvent(this, new MyEventArgs("Opening in remote myTube!...", messageType.Indefinite, false)); this.startTimer(); var status = await RemoteLaunch.TryShareURL(this.remoteSystem, RemoteLaunch.ParseYoutubeLinkToMyTubeUri(url)); this.stopTimer(); if (status == RemoteLaunchUriStatus.Success) { this.NotifyEvent(this, new MyEventArgs(status.ToString(), messageType.Timed, false)); } else if (status == RemoteLaunchUriStatus.ProtocolUnavailable) { await this.OpenStore(RemoteLaunch.MYTUBE_STORE); } else { this.NotifyEvent(this, new MyEventArgs(status.ToString(), messageType.Indefinite, false)); } }
public async void ShareMessage(string message) { this.NotifyEvent(this, new MyEventArgs("Sending to remote clipboard...", messageType.Indefinite, false)); this.startTimer(); var status = await RemoteLaunch.TrySharetext(this.remoteSystem, message); this.stopTimer(); if (status == RemoteLaunchUriStatus.Success) { this.NotifyEvent(this, new MyEventArgs(status.ToString(), messageType.Timed, false)); } else if (status == RemoteLaunchUriStatus.ProtocolUnavailable) { await this.OpenStore(RemoteLaunch.MYAPP_STORE); } else { this.NotifyEvent(this, new MyEventArgs(status.ToString(), messageType.Indefinite, false)); } }
private async Task OpenStore() { this.NotifyEvent(this, new MyEventArgs("App not installed on target device..", messageType.Indefinite, false)); var status = await RemoteLaunch.TryOpenStoreToApp(this.RemoteSystem, RemoteLaunch.MYAPP_STORE); }