예제 #1
0
 /// <summary>
 /// Open password Window
 /// </summary>
 private void PassGenButton_Click(object sender, RoutedEventArgs e)
 {
     if (_passwordWindow == null)
     {
         _passwordWindow         = new Pages.PasswordWindow();
         _passwordWindow.Closed += PasswordWindow_Closed;
         _passwordWindow.Owner   = Application.Current.MainWindow;
         _passwordWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
         _passwordWindow.Show();
     }
     _passwordWindow.Show();
 }
예제 #2
0
        private void IdNumberPasteTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            string idNumber   = idNumberPasteTextBox.Text;
            var    IDList     = idNumber.Select(x => Convert.ToInt32(x.ToString())).ToArray();
            var    IDlistLast = idNumber.Skip(6).Take(5).ToArray();

            if (_passwordWindow == null)
            {
                _passwordWindow         = new Pages.PasswordWindow();
                _passwordWindow.Closed += PasswordWindow_Closed;
                _passwordWindow.Owner   = Application.Current.MainWindow;
                _passwordWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                _passwordWindow.Show();
                _passwordWindow.Activate();
            }
            else
            {
                _passwordWindow.Activate();
            }
            _passwordWindow.idNumberTextBox.Text = idNumberPasteTextBox.Text;



            var random = new Random();

            switch (random.Next(1, 10))
            {
            case 1:
                _passwordWindow.firstIDNumberTextBox.Text      = IDlistLast[0].ToString();
                _passwordWindow.firstIDNumberOrderTextBox.Text = "7";

                _passwordWindow.secondIDNumberTextBox.Text      = IDlistLast[1].ToString();
                _passwordWindow.secondIDNumberOrderTextBox.Text = "8";
                break;

            case 2:
                _passwordWindow.firstIDNumberTextBox.Text      = IDlistLast[0].ToString();
                _passwordWindow.firstIDNumberOrderTextBox.Text = "7";

                _passwordWindow.secondIDNumberTextBox.Text      = IDlistLast[2].ToString();
                _passwordWindow.secondIDNumberOrderTextBox.Text = "9";
                break;

            case 3:
                _passwordWindow.firstIDNumberTextBox.Text      = IDlistLast[0].ToString();
                _passwordWindow.firstIDNumberOrderTextBox.Text = "7";

                _passwordWindow.secondIDNumberTextBox.Text      = IDlistLast[3].ToString();
                _passwordWindow.secondIDNumberOrderTextBox.Text = "10";
                break;

            case 4:
                _passwordWindow.firstIDNumberTextBox.Text      = IDlistLast[0].ToString();
                _passwordWindow.firstIDNumberOrderTextBox.Text = "7";

                _passwordWindow.secondIDNumberTextBox.Text      = IDlistLast[4].ToString();
                _passwordWindow.secondIDNumberOrderTextBox.Text = "11";
                break;

            case 5:
                _passwordWindow.firstIDNumberTextBox.Text      = IDlistLast[1].ToString();
                _passwordWindow.firstIDNumberOrderTextBox.Text = "8";

                _passwordWindow.secondIDNumberTextBox.Text      = IDlistLast[2].ToString();
                _passwordWindow.secondIDNumberOrderTextBox.Text = "9";
                break;

            case 6:
                _passwordWindow.firstIDNumberTextBox.Text      = IDlistLast[1].ToString();
                _passwordWindow.firstIDNumberOrderTextBox.Text = "8";

                _passwordWindow.secondIDNumberTextBox.Text      = IDlistLast[3].ToString();
                _passwordWindow.secondIDNumberOrderTextBox.Text = "10";
                break;

            case 7:
                _passwordWindow.firstIDNumberTextBox.Text      = IDlistLast[1].ToString();
                _passwordWindow.firstIDNumberOrderTextBox.Text = "8";

                _passwordWindow.secondIDNumberTextBox.Text      = IDlistLast[4].ToString();
                _passwordWindow.secondIDNumberOrderTextBox.Text = "11";
                break;

            case 8:
                _passwordWindow.firstIDNumberTextBox.Text      = IDlistLast[2].ToString();
                _passwordWindow.firstIDNumberOrderTextBox.Text = "9";

                _passwordWindow.secondIDNumberTextBox.Text      = IDlistLast[3].ToString();
                _passwordWindow.secondIDNumberOrderTextBox.Text = "10";
                break;

            case 9:
                _passwordWindow.firstIDNumberTextBox.Text      = IDlistLast[2].ToString();
                _passwordWindow.firstIDNumberOrderTextBox.Text = "9";

                _passwordWindow.secondIDNumberTextBox.Text      = IDlistLast[4].ToString();
                _passwordWindow.secondIDNumberOrderTextBox.Text = "11";
                break;

            case 10:
                _passwordWindow.firstIDNumberTextBox.Text      = IDlistLast[3].ToString();
                _passwordWindow.firstIDNumberOrderTextBox.Text = "10";

                _passwordWindow.secondIDNumberTextBox.Text      = IDlistLast[4].ToString();
                _passwordWindow.secondIDNumberOrderTextBox.Text = "11";
                break;
            }
        }