EnterToken.xaml.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace WinUI.OnboardProcess
  16. {
  17. /// <summary>
  18. /// Interaction logic for EnterToken.xaml
  19. /// </summary>
  20. public partial class EnterToken : UserControl, ISwitchable
  21. {
  22. public EnterToken()
  23. {
  24. InitializeComponent();
  25. if (!string.IsNullOrEmpty(CentralAPI.Instance.Central.APIKey))
  26. {
  27. APITokenInput.Text = CentralAPI.Instance.Central.APIKey;
  28. }
  29. }
  30. public void UtilizeState(object staqte)
  31. {
  32. }
  33. private void Next_Click(object sender, RoutedEventArgs e)
  34. {
  35. CentralAPI api = CentralAPI.Instance;
  36. if (api.Central.APIKey != APITokenInput.Text)
  37. {
  38. CentralServer server = new CentralServer();
  39. server.APIKey = APITokenInput.Text;
  40. api.Central = server;
  41. }
  42. Switcher.Switch(new CreateOrJoin());
  43. }
  44. private void BackButton_Click(object sender, RoutedEventArgs e)
  45. {
  46. Switcher.Switch(new RegisterOrLogIn());
  47. }
  48. }
  49. }