PageRenderTime 57ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/HatenaPhotLife/SettingWindow.xaml.cs

https://bitbucket.org/ugaya40/instant-image-uploader
C# | 73 lines | 62 code | 8 blank | 3 comment | 2 complexity | 5f5f229e0de387446190953d48b28f59 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. using HatenaPhotLife.Properties;
  15. namespace HatenaPhotLife
  16. {
  17. /// <summary>
  18. /// SettingWindow.xaml の相互作用ロジック
  19. /// </summary>
  20. public partial class SettingWindow : Window
  21. {
  22. public SettingWindow()
  23. {
  24. InitializeComponent();
  25. }
  26. private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
  27. {
  28. Check();
  29. }
  30. private void TextBoxs_TextChanged(object sender, TextChangedEventArgs e)
  31. {
  32. Check();
  33. }
  34. private void Check()
  35. {
  36. if (string.IsNullOrEmpty(UserIdTextBox.Text) || string.IsNullOrEmpty(PasswordBox.Password))
  37. {
  38. OkButton.IsEnabled = false;
  39. }
  40. else
  41. {
  42. OkButton.IsEnabled = true;
  43. }
  44. }
  45. private void OkButton_Click(object sender, RoutedEventArgs e)
  46. {
  47. Settings.Default.UserName = UserIdTextBox.Text;
  48. Settings.Default.Password = PasswordBox.Password;
  49. Settings.Default.FolderName = FolderTextBox.Text;
  50. Settings.Default.Save();
  51. this.Close();
  52. }
  53. private void CancelButton_Click(object sender, RoutedEventArgs e)
  54. {
  55. this.Close();
  56. }
  57. private void Window_Loaded(object sender, RoutedEventArgs e)
  58. {
  59. Settings.Default.Reload();
  60. UserIdTextBox.Text = Settings.Default.UserName;
  61. PasswordBox.Password = Settings.Default.Password;
  62. FolderTextBox.Text = Settings.Default.FolderName;
  63. }
  64. }
  65. }