Example #1
0
 //конструктор принимающий логин и пароль из формы с созданием пользователя
 public Form1(string log, string pass)
 {
     InitializeComponent();
     LoginBox.Select();
     LoginBox.Text = log;
     PassBox.Text  = pass;
 }
Example #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            User        usr      = new User();
            bool        isUsed   = false;
            List <User> allUsers = _userRepo.getAllUsers();

            usr.Login    = LoginBox.Text;
            usr.Password = _PasswordBox.Password;
            foreach (var usrs in allUsers)
            {
                if (usr.Login == usrs.Login)
                {
                    LoginBox.Clear();
                    _PasswordBox.Clear();
                    isUsed = true;
                }
            }
            if (isUsed)
            {
                MessageBox.Show("This login is already used");
            }
            else
            {
                _userRepo.RegisterUser(usr);
                _buyService.BuyGame(_gameRepo.FindByFullName("CSGO"), usr);
                new LibraryPage(_gameRepo, _userRepo, _buyService, _calcStrat, null, usr).Show();
                this.Hide();
            }
        }
        private void RegisterButton_Click(object sender, RoutedEventArgs e)
        {
            using (SQLiteConnection Base = new SQLiteConnection("Data source=Users.db"))
            {
                Base.Open();

                if (M.FindUser(Base, LoginBox.Text) == null)
                {
                    if (M.PasswordHash(PasswordBox.Password) == M.PasswordHash(PasswordBox_Double.Password))
                    {
                        ((App)Application.Current).log.Trace("Пользователь успешно зарегистрирован");

                        M.NewUser(Base, LoginBox.Text, M.PasswordHash(PasswordBox.Password));

                        NavigationService.Navigate(Pages.LoginPage);
                    }
                    else
                    {
                        PasswordBox.Clear(); PasswordBox_Double.Clear(); MessageBox.Show("Вы ввели несовпадающие пароли");
                    }
                }
                else
                {
                    LoginBox.Clear(); MessageBox.Show("Имя пользователя занято");
                }
            }
        }
Example #4
0
        private void SignUp_Click(object sender, EventArgs e)
        {
            if (LoginBox.Text.Length == 0)
            {
                Message.Warning("Empty login!", Text);
                return;
            }
            if (PasswordBox.Text.Length == 0)
            {
                Message.Warning("Empty password!", Text);
                return;
            }
            bool result = DB.CheckLogin(LoginBox.Text);

            if (!result)
            {
                Message.Error(DB.Status, Text);
            }
            else
            {
                result = DB.Register(LoginBox.Text, PasswordBox.Text);
                if (!result)
                {
                    Message.Error(DB.Status, Text);
                }
                else
                {
                    Message.Info("You have successfully registered!" + Environment.NewLine + "Log in using the registration data.", Text);
                }
                Journal.Append(String.Format("{0} registered", LoginBox.Text));
            }
            LoginBox.Clear();
            PasswordBox.Clear();
            LoginBox.Focus();
        }
Example #5
0
        private void SignIn_Click(object sender, EventArgs e)
        {
            if (LoginBox.Text.Length == 0)
            {
                Message.Warning("Empty login!", Text);
                return;
            }
            if (PasswordBox.Text.Length == 0)
            {
                Message.Warning("Empty password!", Text);
                return;
            }
            bool success = DB.Login(LoginBox.Text, PasswordBox.Text);

            if (!success)
            {
                Message.Error(DB.Status, Text);
                PasswordBox.Clear();
                PasswordBox.Focus();
            }
            else
            {
                LoginBox.Clear();
                PasswordBox.Clear();
                MainForm form = new MainForm();
                form.Show(this);
                Hide();
            }
        }
Example #6
0
 private void EnterButton_Click(object sender, RoutedEventArgs e)
 {
     if (new ValidationClass().CheckIfNotEmpty(LoginBox.Text, PasswordBox.Password))
     {
         PasskeeperModelContext db = new PasskeeperModelContext();
         try
         {
             var findUser = db.Users.FirstOrDefault(u => u.Username == LoginBox.Text);
             if (findUser != null && PasswordProtect.ValidatePassword(PasswordBox.Password, findUser.MasterPassword))
             {
                 MainWindow.LoggedUser = findUser.UserId;
                 MainWindow.Secret     = findUser.Username;
                 DialogResult          = true;
             }
             else
             {
                 MessageBox.Show("Wrong login or password!");
                 PasswordBox.Password = "";
                 LoginBox.Focus();
             }
         }
         catch (Exception err)
         {
             MessageBox.Show(err.ToString());
         }
     }
     else
     {
         MessageBox.Show("Please populate all fields!");
     }
 }
Example #7
0
 /// <summary>
 ///     Инициализация страницы авторизации
 /// </summary>
 public LoginPage()
 {
     InitializeComponent();
     LoginBox.Text        = ConfigManager.Config.RegData.Username;
     PasswordBox.Password = ConfigManager.Config.RegData.Password;
     LoginBox.Focus(FocusState.Programmatic);
 }
Example #8
0
        private void RegisterMethod(/*object obj*/)
        {
            ThicknessAnimation errorAnimation = new ThicknessAnimation();

            errorAnimation.Duration          = TimeSpan.FromSeconds(0.4);
            errorAnimation.From              = new Thickness(0);
            errorAnimation.To                = new Thickness(3);
            errorAnimation.AccelerationRatio = 0.3;
            errorAnimation.DecelerationRatio = 0.7;
            errorAnimation.AutoReverse       = true;

            string pass = (PasswordTextBox.Visibility == Visibility.Visible) ? PasswordTextBox.Text : PasswordBoxBox.Password;

            if (LoginBox.Text.Contains(' '))
            {
                LoginBox.BeginAnimation(BorderThicknessProperty, errorAnimation);
                ShowErrorWindow("Can't use spaces");
            }
            else if (pass == "")
            {
                PasswordTextBox.BeginAnimation(BorderThicknessProperty, errorAnimation);
            }
            else
            {
                try
                {
                    tcpClient = new TcpClient();
                    tcpClient.Connect(ServerIp, ServerPort);
                    WriteToStream(tcpClient.GetStream(), $"REGU {LoginBox.Text} {pass}");

                    string data = ReadStringFromStream(tcpClient.GetStream());
                    if (data == "OK")
                    {
                        Login    = LoginBox.Text;
                        Password = pass;

                        LoadGroups();
                        ShowSuccessWindow("Successfully registered");
                        var animation = new ThicknessAnimation();
                        animation.From              = new Thickness(0, 0, 0, 0);
                        animation.To                = new Thickness(0, -500, 0, 500);
                        animation.Duration          = TimeSpan.FromSeconds(1);
                        animation.AccelerationRatio = 0.3;
                        animation.DecelerationRatio = 0.7;
                        LogInGrid.BeginAnimation(MarginProperty, animation);
                    }
                    else if (data == "USER")
                    {
                        ShowErrorWindow("Login already used");
                        LoginBox.BeginAnimation(BorderThicknessProperty, errorAnimation);
                    }
                    tcpClient.Close();
                }
                catch (Exception)
                {
                    ShowErrorWindow("Something went wrong");
                }
            }
        }
 public AdministrationLoginWindow(MainWindow mainWindow)
 {
     InitializeComponent();
     _dataManager = new DataManager();
     _mainWindow  = mainWindow;
     succes       = false;
     LoginBox.Focus();
 }
Example #10
0
 private void loginBoxLostFocus(object sender, RoutedEventArgs e)
 {
     if (LoginBox.Text == "")
     {
         login = "******";
         LoginBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
     }
 }
 public MainWindow()
 {
     if (!InstanceAlreadyRunning())
     {
         InitializeComponent();
         LoginBox.Focus();
     }
 }
Example #12
0
 public LogIn()
 {
     InitializeComponent();
     WindowHelper.SmallWindowSettings(this);
     UserCredentials.Clear();
     LoginFailed.Visibility = Visibility.Hidden;
     LoginBox.Focus();
 }
        /// <summary>
        /// Отправление данных выбранному клиенту.
        /// </summary>
        /// /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            if (clientComboBox.Items.Count != 0)
            {
                object selectItem = clientComboBox.SelectedItem; // определение номера выбранного клиента

                if (selectItem != null)
                {
                    int cbNum = (int)selectItem;

                    StateObject currentClient = clients.First((item) => item.clientNum == cbNum);                 // поиск нужного клиента в списке подлючений, его выбор

                    if (currentClient.sizePacket == currentClient.sizeReceived && currentClient.sizeReceived > 0) // если данные были корректно приняты
                    {
                        // считывание данных с полей ввода
                        string login    = LoginBox.Text;
                        string password = PasswordBox.Text;

                        if (login != string.Empty && password != string.Empty)
                        {
                            string message = "\nАдминистратор успешно проверил информацию." +
                                             "\nВаши авторизационные данные представлены ниже." +
                                             "\n\n----------\nЛогин: " + login + "\n" + "Пароль: " + password + "\n----------"; // отправляемая строка данных

                            // отправление данных, закрытие подлючения
                            bool state = Send(currentClient.workSocket, message);

                            if (state == true)
                            {
                                _ = sendDone.WaitOne(); // ожидание завершения передачи
                            }

                            // удаление клиента из общего списка и из "clientComboBox" по завершению передачи данных
                            _ = clients.Remove(currentClient);
                            clientComboBox.Items.Remove(clientComboBox.SelectedItem);
                            LoginBox.Clear();
                            PasswordBox.Clear();
                        }
                        else
                        {
                            _ = MessageBox.Show("Введите логин и пароль!", "Ошибка!");
                        }
                    }
                    else
                    {
                        _ = MessageBox.Show("Сначала необходимо получить и проверить данные от пользователя (фотографию, документ)!", "Ошибка!");
                    }
                }
                else
                {
                    _ = MessageBox.Show("Выберите пользователя, которому хотите отправить данные!", "Ошибка!");
                }
            }
            else
            {
                _ = MessageBox.Show("Нет доступных подключений!", "Ошибка!");
            }
        }
Example #14
0
 public void addLoginBox()
 {
     LoginBox = new LoginBox();
     this.pnlPages.Controls.Add(LoginBox);
     LoginBox.Location = new Point(0, 0);
     LoginBox.LinkToSignUpClick(linkToSignUp_Click);
     LoginBox.BtnLoginClick(new SignInHandler(this).Handle);
     LoginBox.TxtPasswordEnter(new SignInHandler(this).Handle2);
 }
Example #15
0
        void Polacznie1()
        {
            MySqlConnection  polaczenie = new MySqlConnection("server=localhost; user=root; database=food; port=3306; pooling=false");
            MySqlDataAdapter komenda    = new MySqlDataAdapter("SELECT count(id) FROM data where Login='******'", polaczenie);

            try
            {
                DataTable dt = new DataTable();
                komenda.Fill(dt);
                if (dt.Rows[0][0].ToString() == "1")
                {
                    MD5    hashMd5 = MD5.Create();
                    string haslo   = GetMd5Hash(hashMd5, PasswodBox.Text);

                    MySqlDataAdapter komenda1 = new MySqlDataAdapter("SELECT Password FROM data where Login='******'", polaczenie);
                    DataTable        dt1      = new DataTable();
                    komenda1.Fill(dt1);

                    string haslozBazy = dt1.Rows[0][0].ToString();

                    if (VerifyMd5Hash(hashMd5, PasswodBox.Text, haslozBazy))
                    {
                        Set_Login = "******" + LoginBox.Text;
                        MessageBox.Show("Login Succes.", "Congrates", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Hide();
                        Form1 NewPanel = new Form1();
                        NewPanel.Show();
                    }
                    else
                    {
                        MessageBox.Show("Either your Password is incorrect.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        LoginBox.Clear();
                        PasswodBox.Clear();
                    }
                }
                else
                {
                    MessageBox.Show("This Login not Exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    LoginBox.Clear();
                    PasswodBox.Clear();
                }
            }
            catch (Exception ex)
            {
                string byk = string.Format("Problem registering user: \n{0}.", ex.Message);
                MessageBox.Show(byk, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (polaczenie.State == ConnectionState.Open)
                {
                    polaczenie.Close();
                }
            }
        }
        void Rejestracja()
        {
            MySqlConnection polaczenie = new MySqlConnection("server=localhost; user=root; database=food; port=3306; pooling=false");
            MySqlCommand    komenda    = polaczenie.CreateCommand();
            MySqlCommand    komenda1   = polaczenie.CreateCommand();

            try
            {
                if (polaczenie.State == ConnectionState.Closed)
                {
                    polaczenie.Open();

                    string haslo = PasswordBox.Text;

                    using (MD5 hash = MD5.Create())
                    {
                        haslo = GetMd5Hash(hash, haslo);
                    }

                    komenda1.CommandText = string.Format("SELECT count(id) FROM data where Login='******'");
                    int wartosc = Convert.ToInt32(komenda1.ExecuteScalar());
                    if (wartosc == 1)
                    {
                        MessageBox.Show(String.Format("Login: {0}, already exists.", LoginBox.Text), "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        komenda.CommandText = string.Format("INSERT INTO data(Login,Password,Resort,Street,NumerHouse) VALUES('{0}','{1}','{2}','{3}','{4}')", LoginBox.Text, haslo, ResortBox.Text, StreetBox.Text, HostNumberBox.Text);
                        if (komenda.ExecuteNonQuery() == 1)
                        {
                            MessageBox.Show("You have logged successfuly. Now you can Login!", "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Login Error.", "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    HostNumberBox.Clear(); StreetBox.Clear(); ResortBox.Clear(); LoginBox.Clear(); PasswordBox.Clear(); LoginBox.Focus();
                }
            }
            catch (Exception ex)
            {
                string byk = string.Format("Problem register with user: \n{0}.", ex.Message);
                MessageBox.Show(byk, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (polaczenie.State == ConnectionState.Open)
                {
                    polaczenie.Close();
                }
            }
        }
Example #17
0
        public Login()
        {
            InitializeComponent();
            db    = Database.getInstanece();
            login = "******";
            Binding b = new Binding();

            b.Source = this;
            b.Path   = new PropertyPath("login");
            b.Mode   = BindingMode.TwoWay;
            LoginBox.SetBinding(TextBox.TextProperty, b);
        }
 void checkconnectivity()
 {
     while (true)
     {
         try{
             Ping      p  = new Ping();
             PingReply pr = p.Send("3.14.219.83");
             if (pr.Status.ToString().Equals("Success"))
             {
                 if (LoginBox.InvokeRequired)
                 {
                     LoginBox.Invoke(new Action(() => {
                         LoginBox.Enabled = true;
                     }));
                 }
                 if (netava.InvokeRequired)
                 {
                     netava.Invoke(new Action(() =>
                     {
                         netava.Text      = "Connected";
                         netava.ForeColor = Color.Green;
                     }));
                 }
                 if (acc_saved == true)
                 {
                     if (Login.InvokeRequired)
                     {
                         Login.Invoke(new Action(() =>
                         {
                             Login.PerformClick();
                         }));
                     }
                     Thread.Sleep(2000);
                 }
             }
         }
         catch (PingException) {
             if (LoginBox.InvokeRequired)
             {
                 LoginBox.Invoke(new Action(() => {
                     LoginBox.Enabled = false;
                 }));
             }
             if (netava.InvokeRequired)
             {
                 netava.Invoke(new Action(() => {
                     netava.ForeColor = Color.Red; netava.Text = "Not Connected";
                 }));
             }
         }
         Thread.Sleep(2000);
     }
 }
Example #19
0
 private async void CommentButton_OnClick(object sender, RoutedEventArgs e)
 {
     if (!User.IsLogin)
     {
         LoginBox lb = new LoginBox();
         lb.LoginCompleted += CommentSubmitShow;
         await lb.ShowAsync();
     }
     else
     {
         CommentSubmitShow(this, User.UserLoginData);
     }
 }
Example #20
0
        private void LoginCavetube()
        {
            var loginBox  = new LoginBox();
            var viewModel = new LoginBoxViewModel();

            viewModel.OnClose += () => {
                loginBox.Close();
            };
            loginBox.DataContext = viewModel;
            loginBox.ShowDialog();

            base.OnPropertyChanged("LoginStatus");
            this.PostName = this.config.UserId;
        }
Example #21
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            string Hash;

            using (SQLiteConnection Base = new SQLiteConnection("Data source=Users.db"))
            {
                Base.Open();

                Hash = M.FindUser(Base, LoginBox.Text);

                if (Hash != null)
                {
                    if (Hash == M.PasswordHash(PasswordBox.Password))
                    {
                        ((App)Application.Current).log.Trace("Пользователь успешно вошёл в систему");

                        ((App)Application.Current).CurrentUser = LoginBox.Text;

                        try
                        {
                            ((App)Application.Current).S = M.DeSerialise(((App)Application.Current).CurrentUser); // Загрузка файла настроек

                            Pages.SettingsPage.Refresh();

                            ((App)Application.Current).log.Trace("Загружены настройки");
                        }
                        catch
                        { ((App)Application.Current).log.Trace("Файл настроек не найден и будет создан в дальнейшем");
                          try
                          {
                              M.OpenReadMe();
                          }
                          catch { MessageBox.Show("Кажется, кто-то удалил руководство пользователя"); } }

                        Base.Close();

                        NavigationService.Navigate(Pages.MainPage);
                    }
                    else
                    {
                        PasswordBox.Clear(); MessageBox.Show("Введён неверный пароль");
                    }
                }
                else
                {
                    LoginBox.Clear(); PasswordBox.Clear(); MessageBox.Show("Пользователь не существует");
                }
            }
        }
Example #22
0
 public Login()
 {
     InitializeComponent();
     Client = new ClientViewModel(new Client());
     Client.AuthorizationSucceeded += () => Do(() => NavigationService.Navigate(new MainPage(Client)));
     Client.AuthorizationFailed    += message => Do(() => MessageBox.Show(message));
     Client.RegistrationSucceeded  += () => Do(() =>
     {
         MessageBox.Show("Успешная регистрация");
         Client.AuthorizationCommand.Execute((LoginBox.Text, PasswordBox.Password));
     });
     Client.RegistrationFailed += message => Do(() => MessageBox.Show(message));
     DataContext = Client;
     LoginBox.Focus();
 }
Example #23
0
 // Use this for initialization
 void Start()
 {
     activeClient  = GameObject.Find("GameClient").GetComponent <Client>();
     player        = GameObject.Find("Player").GetComponent <Player>();
     guiBox        = GameObject.Find("GUI").GetComponent <LoginBox>();
     serverCommand = new Queue();
     command       = "";
     start         = false;
     move          = false;
     send          = false;
     pellets       = new Pellet[4];
     for (int i = 0; i < 4; i++)
     {
         pellets[i] = GameObject.Find("Pellet" + (i + 1).ToString()).GetComponent <Pellet>();
     }
 }
        private void UpdateTeacherClick(object sender, RoutedEventArgs e)
        {
            string ConnectionString = @"Data Source=DESKTOP-15P21ID;Initial Catalog=kursovoi;Integrated Security=True";
            string sqlExpression    = $"SELECT id,name From facylties where name='{faculty}'";

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();
                SqlCommand    command = new SqlCommand(sqlExpression, connection);
                SqlDataReader reader  = command.ExecuteReader();
                SqlCommand    cm1     = connection.CreateCommand();
                try
                {
                    while (reader.Read())
                    {
                        object s = reader.GetValue(0);
                        fakk_id = Convert.ToInt32(s);
                    }
                    reader.Close();
                    if (fakk_id == 0)
                    {
                        MessageBox.Show("Такого факультета не существует");
                    }
                    else
                    {
                        cm1.CommandText = "update users set first_name='" + SurnameBox.Text + "',middle_name='" + NameBox.Text + "',login='******',email='" + PostBox.Text + "',faculty_id='" + fakk_id + "' where id='" + id_admin_panel + "'";
                        cm1.ExecuteNonQuery();
                        MessageBox.Show("Данные успешно обновлены!");
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    SurnameBox.Clear();
                    NameBox.Clear();
                    LoginBox.Clear();
                    PostBox.Clear();
                    FacultyBox.Clear();
                    connection.Close();
                    reader.Close();
                }
            }
        }
Example #25
0
        private void Keypad_Btn_Click(object sender, EventArgs e)
        {
            string buttonText = ((Button)sender).Text;

            if (buttonText == "Delete")
            {
                LoginBox.Text = LoginBox.Text.Substring(0, (LoginBox.TextLength - 1));
            }
            else
            {
                LoginBox.AppendText(buttonText);
                if (LoginBox.TextLength == MaxValue)
                {
                    LoginEmployee();
                }
            }
        }
Example #26
0
        private void enterButton_Click(object sender, RoutedEventArgs e)
        {
            if (!succes)
            {
                string login    = LoginBox.Text;
                string password = GetMd5Hash(passwordBox.Password);

                var accounts = _dataManager.Accounts.ToList();
                foreach (Account a in accounts)
                {
                    if (a.Login == login && a.Passw == password)
                    {
                        succes = true;
                        Login  = login;
                        break;
                    }
                }

                if (succes)
                {
                    statusEnter.Foreground = Brushes.Green;
                    statusEnter.Content    = $"Успешно вход через : {countTimer}";

                    timer          = new DispatcherTimer();
                    timer.Interval = new TimeSpan(0, 0, 0, 0, 250);
                    timer.Tick    += new EventHandler(timer_Tick);
                    timer.Start();



                    _mainWindow.Close();

                    BuyerWindow buyerWindow = new BuyerWindow();
                    buyerWindow.ShowDialog();

                    this.Close();
                }
                else
                {
                    statusEnter.Content = "Неверные данные!";
                }
                LoginBox.Clear();
                passwordBox.Clear();
            }
        }
        public MainWindow()
        {
            // APP init:
            InitializeComponent();
            LoginBox.Focus();
            ContextFactory.SetConnectionParameters("localhost", "admin", "", "cashierbase"); // LOCAL access

            _docNum = GetDocNum();

            SelectGood.Visibility = Visibility.Hidden;
            Plus.Visibility       = Visibility.Hidden;
            Minus.Visibility      = Visibility.Hidden;
            Finish.Visibility     = Visibility.Hidden;

            // Clocks timer:
            var dispatcherTimer = new DispatcherTimer();

            dispatcherTimer.Tick    += Clocks;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();
        }
Example #28
0
 private void CaptchaBox_OnKeyDown(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
 {
     if (e.Key == VirtualKey.Enter)
     {
         if (!string.IsNullOrWhiteSpace(CaptchaBox.Text))
         {
             if (string.IsNullOrWhiteSpace(LoginBox.Text))
             {
                 LoginBox.Focus(FocusState.Keyboard);
             }
             else if (string.IsNullOrWhiteSpace(PasswordBox.Password))
             {
                 PasswordBox.Focus(FocusState.Keyboard);
             }
             else
             {
                 ViewModel.LoginCommand.Execute(null);
             }
         }
     }
 }
Example #29
0
 private void PasswordBox_OnKeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == VirtualKey.Enter)
     {
         if (!string.IsNullOrWhiteSpace(PasswordBox.Password))
         {
             if (string.IsNullOrWhiteSpace(LoginBox.Text))
             {
                 LoginBox.Focus(FocusState.Keyboard);
             }
             else if (CaptchaForm.Visibility == Visibility.Visible && string.IsNullOrWhiteSpace(CaptchaBox.Text))
             {
                 CaptchaBox.Focus(FocusState.Keyboard);
             }
             else
             {
                 ((LoginViewModel)DataContext).LoginCommand.Execute(null);
             }
         }
     }
 }
Example #30
0
 private void PasswordBox_KeyDown(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
 {
     if (e.Key == VirtualKey.Enter)
     {
         //for unknown reason calls twice (on Enter)
         if (!string.IsNullOrWhiteSpace(PasswordBox.Password))
         {
             if (string.IsNullOrWhiteSpace(LoginBox.Text))
             {
                 LoginBox.Focus(FocusState.Keyboard);
             }
             else if (CaptchaForm.Visibility == Visibility.Visible && string.IsNullOrWhiteSpace(CaptchaBox.Text))
             {
                 CaptchaBox.Focus(FocusState.Keyboard);
             }
             else
             {
                 ViewModel.LoginCommand.Execute(null);
             }
         }
     }
 }
 private void ChangeUser_Command(object param)
 {
     LoginBox lb = new LoginBox();
     if (lb.ShowDialog() == true)
     {
         App.CurrentVendor = lb.FoundUser;
     }
 }
Example #32
0
 // Use this for initialization
 void Start()
 {
     activeClient = GameObject.Find("GameClient").GetComponent<Client>();
     player = GameObject.Find ("Player").GetComponent<Player>();
     guiBox = GameObject.Find("GUI").GetComponent<LoginBox>();
     serverCommand = new Queue();
     command = "";
     start = false;
     move = false;
     send = false;
     pellets = new Pellet[4];
     for(int i = 0; i <4; i++)
     {
         pellets[i] = GameObject.Find ("Pellet" + (i+1).ToString()).GetComponent<Pellet>();
     }
 }
 private void AddPersonToPresentList(Consumer c, DateTime logoutDate = default(DateTime))
 {
     if (c.Gesperrt)
     {
         LoginBox lb = new LoginBox(c.Name);
         if (!lb.ShowDialog() == true)
             return;
     }
     PresentPersons.Add(c);
     AllPersons.Remove(c);
     if(logoutDate == default(DateTime))
         logoutDate = SetLogoutTime(c);
     Bierstrichler.Properties.Settings.Default.LoggedInUsers.Add(c.ID.ToString() + ";" + logoutDate.ToString());
     CreateLogoutTimer(c.ID, logoutDate);
     Bierstrichler.Properties.Settings.Default.Save();
     Log.WriteInformation(App.CurrentVendor.Name + " moved " + c.Name + " to Present List.");
 }