AuthRequestedEventArgs.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright (c) 2022 Vuplex Inc. All rights reserved.
  2. //
  3. // Licensed under the Vuplex Commercial Software Library License, you may
  4. // not use this file except in compliance with the License. You may obtain
  5. // a copy of the License at
  6. //
  7. // https://vuplex.com/commercial-library-license
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. using System;
  15. namespace Vuplex.WebView {
  16. /// <summary>
  17. /// Event args for AuthRequested. Either Continue() or Cancel() must be called in order
  18. /// to resume the page.
  19. /// </summary>
  20. public class AuthRequestedEventArgs : EventArgs {
  21. public AuthRequestedEventArgs(string host, Action<string, string> continueCallback, Action cancelCallback) {
  22. Host = host;
  23. _continueCallback = continueCallback;
  24. _cancelCallback = cancelCallback;
  25. }
  26. /// <summary>
  27. /// The host that requested authentication.
  28. /// </summary>
  29. public readonly string Host;
  30. /// <summary>
  31. /// Declines authentication and resumes the page.
  32. /// </summary>
  33. public void Cancel() => _cancelCallback();
  34. /// <summary>
  35. /// Sends an authentication request to the host.
  36. /// </summary>
  37. public void Continue(string username, string password) => _continueCallback(username, password);
  38. Action _cancelCallback;
  39. Action<string, string> _continueCallback;
  40. }
  41. }