RemoteSystemSession.CreateWatcher 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化并返回 RemoteSystemSessionWatcher 对象,以监视远程会话是否存在。
public:
static RemoteSystemSessionWatcher ^ CreateWatcher();
static RemoteSystemSessionWatcher CreateWatcher();
public static RemoteSystemSessionWatcher CreateWatcher();
function createWatcher()
Public Shared Function CreateWatcher () As RemoteSystemSessionWatcher
返回
要用于发现远程会话的观察程序对象。
Windows 要求
应用功能 |
remoteSystem
|
示例
有关发现远程会话的过程,请参阅下面的代码示例。
// Discover an existing shared experience.
public void DiscoverExistingSessions() {
// create a watcher for remote system sessions
RemoteSystemSessionWatcher sessionWatcher = RemoteSystemSession.CreateWatcher();
// register a handler for the "added" event
sessionWatcher.Added += async (sender, args) => {
// get a reference to the info about the discovered session
RemoteSystemSessionInfo sessionInfo = args.RemoteSystemSessionInfo;
// update the UI with the sessionInfo.DisplayName and
// sessionInfo.ControllerDisplayName strings. Save a reference to
// this RemoteSystemSessionInfo, to use when the user selects
// this session from the UI
//...
};
// Begin watching
sessionWatcher.Start();
}