/HatenaPhotLife/SettingWindow.xaml.cs
C# | 73 lines | 62 code | 8 blank | 3 comment | 2 complexity | 5f5f229e0de387446190953d48b28f59 MD5 | raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using HatenaPhotLife.Properties;
-
- namespace HatenaPhotLife
- {
- /// <summary>
- /// SettingWindow.xaml の相互作用ロジック
- /// </summary>
- public partial class SettingWindow : Window
- {
- public SettingWindow()
- {
- InitializeComponent();
- }
-
- private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
- {
- Check();
- }
-
- private void TextBoxs_TextChanged(object sender, TextChangedEventArgs e)
- {
- Check();
- }
-
- private void Check()
- {
- if (string.IsNullOrEmpty(UserIdTextBox.Text) || string.IsNullOrEmpty(PasswordBox.Password))
- {
- OkButton.IsEnabled = false;
- }
- else
- {
- OkButton.IsEnabled = true;
- }
- }
-
- private void OkButton_Click(object sender, RoutedEventArgs e)
- {
- Settings.Default.UserName = UserIdTextBox.Text;
- Settings.Default.Password = PasswordBox.Password;
- Settings.Default.FolderName = FolderTextBox.Text;
- Settings.Default.Save();
-
- this.Close();
- }
-
- private void CancelButton_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
- }
-
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- Settings.Default.Reload();
- UserIdTextBox.Text = Settings.Default.UserName;
- PasswordBox.Password = Settings.Default.Password;
- FolderTextBox.Text = Settings.Default.FolderName;
- }
- }
- }