pgAuthRm.xaml.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using Redmine.Net.Api;
  2. using Redmine.Net.Api.Types;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace RedmineOracle
  18. {
  19. /// <summary>
  20. /// Логика взаимодействия для pgAuthRm.xaml
  21. /// </summary>
  22. public partial class pgAuthRm : Page
  23. {
  24. ListIstIssues li;
  25. public pgAuthRm()
  26. {
  27. InitializeComponent();
  28. }
  29. private void btnAuth_Click(object sender, RoutedEventArgs e)
  30. {
  31. infoAuth.loginRm = tbLogin.Text;
  32. infoAuth.passwordRm = tbPass.Text;
  33. checkAuth(tbLogin.Text,tbPass.Text);
  34. }
  35. async void checkAuth(string login,string pass)
  36. {
  37. await Task.Run(() =>
  38. {
  39. try
  40. {
  41. var host = "http://testred.ru/";
  42. var a = new RedmineManager(host, login, pass);
  43. User currUser = a.GetCurrentUser();
  44. infoAuth.isAuthForum = true;
  45. Application.Current.Dispatcher.Invoke(() =>
  46. {
  47. LoadPages.rmFrame.Navigate(new pgRmList());
  48. });
  49. }
  50. catch
  51. {
  52. MessageBox.Show("Проверьте введенные данные!");
  53. }
  54. });
  55. }
  56. }
  57. }