| 69 | } |
| 70 | |
| 71 | HRESULT TAPSite::SetSite(IUnknown *pUnkSite) try |
| 72 | { |
| 73 | // only ever 1 VTW at once |
| 74 | if (s_VisualTreeWatcher.get()) |
| 75 | { |
| 76 | throw winrt::hresult_illegal_method_call(); |
| 77 | } |
| 78 | |
| 79 | site.copy_from(pUnkSite); |
| 80 | |
| 81 | if (site) |
| 82 | { |
| 83 | s_VisualTreeWatcher = winrt::make_self<VisualTreeWatcher>(site, GetReadyEvent()); |
| 84 | } |
| 85 | |
| 86 | return S_OK; |
| 87 | } |
| 88 | catch (...) |
| 89 | { |
| 90 | return winrt::to_hresult(); |
| 91 | } |
| 92 | |
| 93 | HRESULT TAPSite::GetSite(REFIID riid, void **ppvSite) noexcept |
| 94 | { |