private async Task <WebAccountProvider> ShowPickerAsync() { AccountsSettingsPane retaccountPane = null; try { #if WINDOWS_APP retaccountPane = AccountsSettingsPane.GetForCurrentView(); retaccountPane.AccountCommandsRequested += Authenticator_AccountCommandsRequested; await AccountsSettingsPane.ShowAddAccountAsync(); #else retaccountPane = AccountsSettingsPaneInterop.GetForWindow(_parentHandle); retaccountPane.AccountCommandsRequested += Authenticator_AccountCommandsRequested; await AccountsSettingsPaneInterop.ShowAddAccountForWindowAsync(_parentHandle); #endif return(_provider); } catch (Exception e) { _logger.ErrorPii(e); throw; } finally { if (retaccountPane != null) { retaccountPane.AccountCommandsRequested -= Authenticator_AccountCommandsRequested; } } }
private async Task ShowPickerForWin32WindowAsync(IntPtr windowHandle) { AccountsSettingsPane retaccountPane = null; try { retaccountPane = AccountsSettingsPaneInterop.GetForWindow(windowHandle); retaccountPane.AccountCommandsRequested += Authenticator_AccountCommandsRequested; await AccountsSettingsPaneInterop.ShowAddAccountForWindowAsync(windowHandle); } catch (Exception ex) { _logger.ErrorPii(ex); throw; } finally { if (retaccountPane != null) { retaccountPane.AccountCommandsRequested -= Authenticator_AccountCommandsRequested; retaccountPane = null; } } }