private void BtnAddAccountClick(object sender, RoutedEventArgs e)
        {
            if (AccountEdit.Instance != null)
            {
                return;
            }

            var window = new AccountEdit();
            window.ShowDialog();
        }
        private void BtnAddAccountClick(object sender, RoutedEventArgs e)
        {
            if (AccountEdit.Instance != null)
            {
                return;
            }

            var window = new AccountEdit();

            window.ShowDialog();
        }
        private void CmEditClick(object sender, RoutedEventArgs e)
        {
            if (AccountsDataGrid.SelectedItems.Count == 0)
            {
                return;
            }

            AccountEdit w = new AccountEdit(AccountsDataGrid.SelectedItems.Cast <Account>().ToList());

            w.ShowDialog();
        }
        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 (AccountEdit.Instance != null || account == null)
            {
                return;
            }

            var w = new AccountEdit(account);

            w.ShowDialog();
        }
        public AccountEdit(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;
        }
        public AccountEdit(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;
        }
 private void BtnAddAccountClick(object sender, RoutedEventArgs e)
 {
     AccountEdit w = new AccountEdit();
     w.ShowDialog();
 }
        private void CmEditClick(object sender, RoutedEventArgs e)
        {
            if (AccountsDataGrid.SelectedItems.Count == 0)
            {
                return;
            }

            AccountEdit w = new AccountEdit(AccountsDataGrid.SelectedItems.Cast<Account>().ToList());
            w.ShowDialog();
        }
        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 (AccountEdit.Instance != null || account == null)
            {
                return;
            }

            var w = new AccountEdit(account);
            w.ShowDialog();
        }
        private void BtnAddAccountClick(object sender, RoutedEventArgs e)
        {
            AccountEdit w = new AccountEdit();

            w.ShowDialog();
        }