Ejemplo n.º 1
0
        private bool ValidateRequiredFields()
        {
            bool passwordIsBad = String.IsNullOrEmpty(PasswordBox.Password);
            bool emailIsBad    = !ValidateEmail(UsernameTextBox.Text);

            if (emailIsBad)
            {
                UsernameTextBox.Focus();
            }
            else if (passwordIsBad)
            {
                PasswordBox.Focus();
            }

            if (passwordIsBad)
            {
                PasswordBox.Background = _errorColorBrush;
            }

            if (emailIsBad)
            {
                UsernameTextBox.Background         = _errorColorBrush;
                EmailFormatErrorMessage.Visibility = Visibility.Visible;
            }

            return(!(passwordIsBad || emailIsBad));
        }
Ejemplo n.º 2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            UserController CallUser = new UserController();

            if (UsernameTextBox.Text.Length == 0 && PasswordTextBox.Password.Length == 0)
            {
                UsernameErrorMessage.Text = "You Must Enter Valid Username!";
                PasswordErrorMessage.Text = "You Must Enter Password!";
                PasswordTextBox.Focus();
                UsernameTextBox.Focus();
            }
            else if (UsernameTextBox.Text.Length == 0)
            {
                UsernameErrorMessage.Text = "You Must Enter Valid Username!";
                UsernameTextBox.Focus();
            }
            else if (PasswordTextBox.Password.Length == 0)
            {
                PasswordErrorMessage.Text = "You Must Enter Password!";
                PasswordTextBox.Focus();
            }
            else
            {
                string username = UsernameTextBox.Text;
                string password = PasswordTextBox.Password;

                CallUser.ChangePass(username, password);
            }
        }
Ejemplo n.º 3
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            if (Username.Length == 0)
            {
                UsernameTextBox.Focus();
                return;
            }
            if (Password.Length == 0)
            {
                PasswordTextBox.Focus();
                return;
            }

            string macAddress = MacAddress;

            if (macAddress != null && macAddress != HardwareHash.Empty && !macAddressRegex.IsMatch(macAddress))
            {
                MacAddressTextBox.Focus();
                return;
            }

            if (HasProxy)
            {
                int port;
                if (int.TryParse(ProxyPortTextBox.Text.Trim(), out port) && port >= 0 && port <= 65535)
                {
                    ProxyPort    = port;
                    DialogResult = true;
                }
            }
            else
            {
                DialogResult = true;
            }
        }
Ejemplo n.º 4
0
        private void ResetButton_Click(object sender, System.EventArgs e)
        {
            PasswordTextBox.Text = string.Empty;
            UsernameTextBox.Text = string.Empty;

            UsernameTextBox.Focus();
        }
Ejemplo n.º 5
0
 private void LoginFailed()
 {
     UsernameTextBox.Focus();
     UsernameTextBox.Background    = _errorColorBrush;
     PasswordBox.Background        = _errorColorBrush;
     LoginFailedMessage.Visibility = Visibility.Visible;
 }
Ejemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         UsernameTextBox.Focus();
     }
 }
Ejemplo n.º 7
0
 private void OK_Click(object sender, EventArgs e)
 {
     // Make sure the user entered something.
     if (UsernameTextBox.Text.Length == 0)
     {
         MessageBox.Show("You must enter a user name");
         UsernameTextBox.Focus();
     }
     else if (PasswordTextBox.Text.Length == 0)
     {
         MessageBox.Show("You must enter a password");
         PasswordTextBox.Focus();
     }
     else if (!PasswordValid(UsernameTextBox.Text, PasswordTextBox.Text))
     {
         // The user name/password is invalid.
         MessageBox.Show("User name/password invalid");
         UsernameTextBox.Focus();
     }
     else
     {
         // The user name/password is valid.
         DialogResult = System.Windows.Forms.DialogResult.OK;
         this.Close();
     }
 }
Ejemplo n.º 8
0
 private void Window_Activated(object sender, EventArgs e)
 {
     if (UsernameTextBox.Text == "")
     {
         UsernameTextBox.Focus();
     }
 }
Ejemplo n.º 9
0
        public MainWindow()
        {
            InitializeComponent();
            UsernameTextBox.Focus();
            _userLogic = new UserLogic();
            KeyDown   += OnEnterDownHandler;
            if (File.Exists("MyConfig.xml"))
            {
                string        username = "", password = "";
                XmlTextReader reader = new XmlTextReader("MyConfig.xml");
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        switch (reader.Name)
                        {
                        case "UserName":
                            reader.Read();
                            username = reader.Value;
                            break;

                        case "Password":
                            reader.Read();
                            password = reader.Value;
                            break;
                        }
                    }
                }
                reader.Close();
                if (!_userLogic.LoginButton_ClickLogic(username, password, this))
                {
                    File.Delete("MyConfig.xml");
                }
            }
        }
Ejemplo n.º 10
0
 private void LoginButton_Click(object sender, RoutedEventArgs e)
 {
     if (Username.Length == 0)
     {
         UsernameTextBox.Focus();
         return;
     }
     if (Password.Length == 0)
     {
         PasswordTextBox.Focus();
         return;
     }
     if (HasProxy)
     {
         int port;
         if (int.TryParse(ProxyPortTextBox.Text.Trim(), out port) && port >= 0 && port <= 65535)
         {
             ProxyPort    = port;
             DialogResult = true;
         }
     }
     else
     {
         DialogResult = true;
     }
 }
Ejemplo n.º 11
0
 public LoginWindow()
 {
     InitializeComponent();
     UsernameTextBox.Focus();
     _notifyIcon = UIHelper.CreateNotifyIconForTray();
     _notifyIcon.MouseDoubleClick += _notifyIcon_MouseDoubleClick;
 }
Ejemplo n.º 12
0
 private void OK_Click(System.Object sender, System.EventArgs e)
 {
     if (UsernameTextBox.Text == "" | PasswordTextBox.Text == "")
     {
         MessageBox.Show("Enter your Username and password!", "Fields Empty", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
     sql.addprams("@name", UsernameTextBox.Text);
     sql.addprams("@pass", PasswordTextBox.Text);
     sql.ExecSql("Select * from users where username = @name and pass = @pass");
     if (sql.count == 0)
     {
         MessageBox.Show("Invalid Username or Password", "Wrong info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         UsernameTextBox.Clear();
         PasswordTextBox.Clear();
         UsernameTextBox.Focus();
         return;
     }
     else
     {
         this.Hide();
         MainInterface mainInterface = new MainInterface();
         mainInterface.FormClosed += (s, args) => this.Close();
         mainInterface.Show();
     }
 }
Ejemplo n.º 13
0
        private void LoginUser()
        {
            List <Account> accounts = Admin.GetCurrentDatabase();

            Account loggedInAccount = null;

            foreach (Account account in accounts)
            {
                if (account.Username == UsernameTextBox.Text && account.Password == PasswordTextBox.Text)
                {
                    loggedInAccount = account;
                    break;
                }
            }

            if (loggedInAccount != null)
            {
                MessageBox.Show("Welcome", "Login Succesful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                UsernameTextBox.Text = "";
                PasswordTextBox.Text = "";
                UsernameTextBox.Focus();

                //Hide the login screen, open the text editor and send the account object to the next login screen.
                Hide();
                TextEditor textEditor = new TextEditor();
                textEditor.MyAccount = loggedInAccount;
                textEditor.Show(this);
            }
            else
            {
                MessageBox.Show("Incorrect Username/Password or Account does not exist.", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                PasswordTextBox.Text = "";
            }
        }
Ejemplo n.º 14
0
        private void SignIn_Click(object sender, RoutedEventArgs e)
        {
            UserController CallUser = new UserController();

            if (UsernameTextBox.Text.Length == 0 && PasswordTextBox.Password.Length == 0)
            {
                UsernameErrorMessage.Text = "You Must Enter Valid Username!";
                PasswordErrorMessage.Text = "You Must Enter Password!";
                PasswordTextBox.Focus();
                UsernameTextBox.Focus();
            }
            else if (UsernameTextBox.Text.Length == 0)
            {
                UsernameErrorMessage.Text = "You Must Enter Valid Username!";
                UsernameTextBox.Focus();
            }
            else if (PasswordTextBox.Password.Length == 0)
            {
                PasswordErrorMessage.Text = "You Must Enter Password!";
                PasswordTextBox.Focus();
            }
            else
            {
                string username = UsernameTextBox.Text;
                string password = PasswordTextBox.Password;

                CallUser.UserLogin(username, password);
                this.Hide();
                Home home = new Home(username);
                home.Show();
            }
        }
Ejemplo n.º 15
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            this.viewModel = (MainViewModel)this.DataContext;

            UsernameTextBox.Text = "Wizard " + new Random().Next(0, 100);
            UsernameTextBox.Focus();
            UsernameTextBox.SelectAll();
        }
 private void PlaceCursorInLoginTextBox()
 {
     Dispatcher.BeginInvoke(DispatcherPriority.Input,
                            new Action(delegate() {
         UsernameTextBox.Focus();
         Keyboard.Focus(UsernameTextBox);
     }));
 }
Ejemplo n.º 17
0
 private void UpdateView(OperationResult operationResult)
 {
     if (!operationResult.Succeed)
     {
         UsernameTextBox.Focus();
         MessageBox.Show(operationResult.Message);
     }
 }
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            UsernameTextBox.Focus();
            UsernameTextBox.SelectAll();

            IRequestFocus focus = (IRequestFocus)DataContext;

            focus.FocusRequested += OnFocusRequested;
        }
Ejemplo n.º 19
0
 public WalletWindow()
 {
     InitializeComponent();
     UsernameTextBox.Focus();
     _notifyIcon              = UIHelper.CreateNotifyIconForTray();
     _notifyIcon.DoubleClick += _notifyIcon_DoubleClick;
     _statusBarOperationMessageStoryBoard = Resources["operationStatusStoryboard"] as Storyboard;
     Messenger.Default.Register <BalanceChangedMessage>(this, BalanceChanged_Handler);
 }
Ejemplo n.º 20
0
 public LoginWindow()
 {
     InitializeComponent();
     //if (GlobalSettings.Startuped)
     //    closeButton.Visibility = Visibility.Visible;
     //else
     //    closeButton.Visibility = Visibility.Hidden;
     UsernameTextBox.Focus();
 }
Ejemplo n.º 21
0
        /**
         * login button - check username and password
         */
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            string username = UsernameTextBox.Text;
            string password = PasswordBox.Password;

            UsernameTextBox.Text = "";
            PasswordBox.Password = "";
            UsernameTextBox.Focus();
            _userLogic.LoginButton_ClickLogic(username, password, this);
        }
 private void PasscodeTextBox_Leave(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(UsernameTextBox.Text))
     {
         UsernameTextBox.Focus();
     }
     else
     {
         LoginTile_Click(null, EventArgs.Empty);
     }
 }
Ejemplo n.º 23
0
 public void SetFocusField()
 {
     if (String.IsNullOrEmpty(UsernameTextBox.Text) ||
         !Constants.EmailMatchPattern.IsMatch(UsernameTextBox.Text))
     {
         UsernameTextBox.Focus();
     }
     else
     {
         PasswordBox.Focus();
     }
 }
Ejemplo n.º 24
0
        public MainWindow()
        {
            InitializeComponent();

            // Initialize remote repository client
            string url = "http://localhost:8080/RemoteRepositoryService"; // Must match URL specified in host

            _Client = new ServiceClient.BasicServiceClient(url);

            UsernameTextBox.Focus();

            this.Loaded += MainWindow_Loaded;
        }
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            Loaded -= OnLoaded;

            // Immediately focus the username textbox
            // when the settings window is opened.
            UsernameTextBox?.Focus();
            UsernameTextBox?.SelectAll();

            // Subscribe to the ICloseable.RequestedClose event
            // to close this view when requested to by the ViewModel.
            this.MakeCloseable();
        }
Ejemplo n.º 26
0
        public LoginWindow()
        {
            InitializeComponent();
            ProxyCheckBox_Checked(null, null);

            Title = App.Name + " - " + Title;
            UsernameTextBox.Focus();

            ServerComboBox.ItemsSource = new List <string>()
            {
                "Sapphire"
            };
            ServerComboBox.SelectedIndex = 0;
        }
Ejemplo n.º 27
0
        public Login()
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; //centriranje

            InitializeComponent();

            UsernameTextBox.Focus();
            Keyboard.Focus(UsernameTextBox);

            if (Application.Current.MainWindow == this)
            {
                Application.Current.MainWindow = null;
            }
        }
 private void UsernameTextBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(PasscodeTextBox.Text))
         {
             UsernameTextBox.Focus();
         }
         else
         {
             LoginTile_Click(null, EventArgs.Empty);
         }
     }
 }
        private bool CheckPassword(IS2G10_DBSSSDataSet.USERPROFILERow userProfile, string sPass)
        {
            var check = _passwordBuilder.CheckPassword(sPass, userProfile.password_hash, userProfile.password_salt);

            //check if password is right
            if (!check)
            {
                _dialogService.CallMessageModal(this, "", SSS_Library.Properties.Resources.IncorrectLoginDetailsMessage);
                PasswordTextBox.Clear();
                UsernameTextBox.Clear();
                UsernameTextBox.Focus();
            }
            return(check);
        }
Ejemplo n.º 30
0
        private void staff_lounge_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <ModelArea> areaLists = (status) ? areaDao.Select(" where a.area_station=" + StationID + " and a.area_lounge=" + lounge.SelectedValue) : areaDao.SelectOffine(" where a.area_station=" + StationID + " and a.area_lounge=" + lounge.SelectedValue);

            if (areaLists != null && areaLists.Count > 0)
            {
                area.DataSource = areaLists;
            }
            else
            {
                MessageBox.Show("ไม่พบ Area ใน " + lounge.Text);
                lounge.SelectedIndex = 0;
                UsernameTextBox.Focus();
            }
        }