예제 #1
0
        private void BtnAddAccountClick(object sender, RoutedEventArgs e)
        {
            if (AccountWindow.Instance != null)
            {
                return;
            }

            var window = new AccountWindow();
            window.ShowDialog();
        }
예제 #2
0
        public AccountWindow(Account account = null)
        {
            InitializeComponent();

            _regionBox.ItemsSource = Enum.GetValues(typeof(Region)).Cast<Region>();
            _regionBox.SelectedItem = Settings.Config.SelectedRegion;

            Instance = this;

            Loaded += (o, a) => UpdateWindow();
            Closed += (o, a) => Instance = null;

            if (account == null)
            {
                return;
            }

            _account = account;

            _usernameBox.Text = _account.Username;
            _passwordBox.Password = _account.Password;
            _passwordBoxText.Text = _account.Password;
            _regionBox.SelectedItem = _account.Region;
        }
예제 #3
0
        private void CmEditClick(object sender, RoutedEventArgs e)
        {
            if (Checker.IsChecking)
            {
                this.ShowMessageAsync("Error", "You can't edit accounts while the checker is working.");
                return;
            }

            var account = _accountsGrid.SelectedItem as Account;

            if (AccountWindow.Instance != null || account == null)
            {
                return;
            }

            var w = new AccountWindow(account);
            w.ShowDialog();
        }
예제 #4
0
        private void CmViewAccount(object sender, RoutedEventArgs e)
        {
            var account = AccountsDataGrid.SelectedItem as Account;

            if (account == null)
            {
                return;
            }

            var window = new AccountWindow(account);
            window.Show();
        }
 private void ViewAccount()
 {
     if (AccountsDataGrid.SelectedItems.Count == 0)
     {
         return;
     }
     AccountWindow window = new AccountWindow((Account)AccountsDataGrid.SelectedItem);
     window.Show();
 }