public void Remove(string name)
        {
            bool    flag    = false;
            UserBox mark    = null;
            UserBox premark = null;

            foreach (UserBox ub in canvas.Children)
            {
                if (flag == true)
                {
                    ub.Margin = new Thickness(5, ub.Margin.Top - ub.Height - 5, 0, 0);
                }
                if (ub.name.Content.ToString() == name)
                {
                    flag = true;
                    mark = ub;
                    if (ub == UserBox.pre)
                    {
                        UserBox.pre = premark;
                    }
                }
                premark = ub;
            }
            if (mark != null)
            {
                canvas.Children.Remove(mark);
            }
            AddBoxMove();
            double h = add.Margin.Top + add.Height + 5;

            if (h < 677)
            {
                canvas.Height = h;
            }
        }
 private void RegButton_Click(object sender, RoutedEventArgs e)
 {
     if (UserBox.GetLineText(0).Length == 0 && PWBox.Password.Length == 0)
     {
         ErrReg.Content = "Missing information";
     }
     else if (UserBox.GetLineText(0).Length == 0)
     {
         ErrReg.Content = "Missing username";
     }
     else if (PWBox.Password.Length == 0)
     {
         ErrReg.Content = "Missing password";
     }
     else if (PWBox.Password.Length < 6)
     {
         ErrReg.Content = "Invalid password";
     }
     else
     {
         regCont.openData();
         if (regCont.getSuccess())
         {
             reference.wohoo();
             this.Close();
         }
     }
 }
        private void UserChange(object sender, EventArgs e)
        {
            UserBox ub   = (UserBox)sender;
            string  name = ub.name.Content.ToString();

            if (this.name == name)
            {
                return;
            }
            if (name == "添加账户")
            {
                InputMoney dlg = new InputMoney();
                dlg.ShowDialog();
                if (dlg.m == 0)
                {
                    return;
                }
                name = dlg.n;
                if (usersController.GetUserControler(name) == null)
                {
                    UserPanelController.Handler().AddUser(dlg.n, dlg.m);
                    MainWindow.ShowNotifyMessage("成功添加新账户\n账户名:" + dlg.n + "本金:" + dlg.m);
                }
                else
                {
                    MessageBox.Show("账户名已存在");
                    return;
                }
            }
            UserChange(name);
        }
        public void Recongize()
        {
            this.Invoke(new MethodInvoker(delegate() {
                Data data   = new Data(BoolToDouble(UserBox.GetArray()));
                double [] d = bm.Recongize(data);
                //Console.WriteLine("----");
                //bm.Debug(d);

                /*
                 * double n = 0;
                 * int m=-1;
                 * for(int i=0;i<10;i++)
                 * {
                 *  if (d[i] > n)
                 *  {
                 *      n = d[i];
                 *      m = i;
                 *  }
                 * }
                 *
                 *
                 * if(n>=(1-bm.minError*2))
                 *  OutputLabel.Text = m.ToString();
                 */

                for (int i = 0; i < d.Length; i++)
                {
                    if (d[i] <= bm.minError * 2)
                    {
                        d[i] = 0;
                    }
                    if (d[i] >= (1 - bm.minError * 2))
                    {
                        d[i] = 1;
                    }
                }

                // bm.Debug(d);

                for (int i = 0; i < 10; i++)
                {
                    bool flag = true;
                    for (int j = 0; j < d.Length; j++)
                    {
                        if (!d[j].Equals(outputtype.getOutput(i)[j]))
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        OutputLabel.Text = i.ToString();
                        return;
                    }
                }
            }));
        }
 private void DelBtn_Click(object sender, EventArgs e)
 {
     DataList.Items.Clear();
     myList.Clear();
     OutputLabel.Text = "Input";
     UserBox.Clear();
     ShowBox.Clear();
     InputBox.Clear();
 }
Exemple #6
0
 private void SetUserBoxFocus()
 {
     UserBox.Dispatcher.Invoke(new Action(() =>
     {
         UserBox.Focus();
         UserBox.Effect   = (DropShadowEffect)MainGrid.Resources["glowEffect"];
         SystemBox.Effect = null;
     }));
 }
Exemple #7
0
 private void ControlTableButton_Click(object sender, EventArgs e)
 {
     StudentPanel.Show();
     label2.Show();
     UserBox.Show();
     TeachersPanel.Hide();
     AdministratorPanel.Hide();
     DepartmentPanel.Hide();
     PasswordPanel.Hide();
 }
Exemple #8
0
        private void UserList(string userlist)
        {
            var users      = userlist.Split('/');
            int countUsers = users.Length;

            UserBox.Invoke((MethodInvoker) delegate { UserBox.Items.Clear(); });
            for (int j = 0; j < countUsers; j++)
            {
                UserBox.Invoke((MethodInvoker) delegate { UserBox.Items.Add(users[j]); });
            }
        }
Exemple #9
0
 private void UserSettingsButton_Click(object sender, EventArgs e)
 {
     UserBox.SelectedIndex = 2;
     PasswordPanel.Show();
     StudentPanel.Hide();
     TeachersPanel.Hide();
     AdministratorPanel.Hide();
     DepartmentPanel.Hide();
     label2.Hide();
     UserBox.Hide();
 }
Exemple #10
0
        public LoginV()
        {
            InitializeComponent();

            Messenger.Default.Register <NotificationMessage>(this, ShowHome);

            if (string.IsNullOrEmpty(UserBox.Text))
            {
                UserBox.Focus();
            }
        }
Exemple #11
0
        private void UserBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string current = selectedUser();
                if (current == "Administratora")
                {
                    AdministratorPanel.Show();
                    label2.Show();
                    UserBox.Show();
                    StudentPanel.Hide();
                    TeachersPanel.Hide();
                    PasswordPanel.Hide();
                    DepartmentPanel.Hide();
                }
                if (current == "Nastavnika")
                {
                    TeachersPanel.Show();
                    label2.Show();
                    UserBox.Show();
                    StudentPanel.Hide();
                    AdministratorPanel.Hide();
                    PasswordPanel.Hide();
                    DepartmentPanel.Hide();
                }
                if (current == "Ucenika i roditelja")
                {
                    StudentPanel.Show();
                    label2.Show();
                    UserBox.Show();
                    TeachersPanel.Hide();
                    AdministratorPanel.Hide();
                    PasswordPanel.Hide();
                    DepartmentPanel.Hide();
                }

                if (current == "Odjeljenja i razrednici")
                {
                    DepartmentPanel.Show();
                    label2.Show();
                    UserBox.Show();
                    StudentPanel.Hide();
                    TeachersPanel.Hide();
                    AdministratorPanel.Hide();
                    PasswordPanel.Hide();
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Exemple #12
0
 public void Add(string name,double pri)
 {
     double height = 0;
     if (UserBox.pre != null)
         height = UserBox.pre.Margin.Top + UserBox.pre.Height;
     UserBox ub = new UserBox(name, pri.ToString());
     ub.Margin = new Thickness(5, height + 5, 0, 0);
     ub.MouseLeftButtonDown += UserChange;
     //ub.MouseRightButtonDown += UserChange;
     canvas.Children.Add(ub);
     AddBoxMove();
     double h = add.Margin.Top + add.Height + 5;
     if (h < 677)
         canvas.Height = h;
 }
Exemple #13
0
        private void EmptyStuff()
        {
            UserBox.Focus();
            UserBox.Text   = String.Empty;
            ApiBox.Text    = String.Empty;
            SecretBox.Text = String.Empty;
            PassBox1.Text  = String.Empty;
            PassBox2.Text  = String.Empty;

            UserBox.Enabled   = true;
            ApiBox.Enabled    = false;
            SecretBox.Enabled = false;
            PassBox1.Enabled  = false;
            PassBox2.Enabled  = false;
            AddButton.Enabled = false;
        }
Exemple #14
0
        public IWebElement Login(string name, string password)
        {
            WaitForElement(By.Id("UserName"));
            UserBox.Clear();
            UserBox.SendKeys(name);

            WaitForElement(By.Id("Password"));
            PasswordBox.Clear();
            PasswordBox.SendKeys(password);

            WaitForElement(By.Id("Login"));
            LoginButton.Click();

            WaitForElement(By.Id("Home"));
            return(HomeElement);
        }
        public IWebElement Register(string name, string password)
        {
            WaitForElement(By.Id("UserName"));
            UserBox.Clear();
            UserBox.SendKeys(name);

            WaitForElement(By.Id("Password"));
            PasswordBox.Clear();
            PasswordBox.SendKeys(password);

            WaitForElement(By.Id("PasswordRepeat"));
            PasswordRepeatBox.Clear();
            PasswordRepeatBox.SendKeys(password);

            WaitForElement(By.Id("Register"));
            RegisterButton.Click();

            //wait for result page - Send the User back to the login page
            WaitForElement(By.Id("Login"));
            return(LoginElement);
        }
 private void ChangePassAdminButton_Click(object sender, EventArgs e)
 {
     if (OldPassTextBox.Text.Length == 0 ||
         NewPassTextBox.Text.Length == 0 ||
         ConfirmedNewPassTextBox.Text.Length == 0)
     {
         Warning();
     }
     else
     {
         if (OldPassTextBox.Text == NewPassTextBox.Text && OldPassTextBox.Text == CurrentUser.Password)
         {
             MessageBox.Show("Unesite novu lozinku koja se razlikuje od stare !");
         }
         else if (Encrypt.hashPassword(OldPassTextBox.Text) == CurrentUser.Password && NewPassTextBox.Text == ConfirmedNewPassTextBox.Text)
         {
             bool isChanged = UsersRepository.ChangePassword(CurrentUser.Id, OldPassTextBox.Text, NewPassTextBox.Text, ConfirmedNewPassTextBox.Text);
             if (isChanged == true)
             {
                 StudentPanel.Show();
                 label2.Show();
                 UserBox.Show();
                 TeachersPanel.Hide();
                 AdministratorPanel.Hide();
                 DepartmentPanel.Hide();
                 PasswordPanel.Hide();
                 UserSettingsButton.Hide();
             }
         }
         else if (NewPassTextBox.Text != ConfirmedNewPassTextBox.Text)
         {
             MessageBox.Show("Nove lozinke se ne poklapaju !");
         }
         else
         {
             MessageBox.Show("Pogrešna lozinka !");
         }
     }
 }
Exemple #17
0
        public void Add(string name, double pri)
        {
            double height = 0;

            if (UserBox.pre != null)
            {
                height = UserBox.pre.Margin.Top + UserBox.pre.Height;
            }
            UserBox ub = new UserBox(name, pri.ToString());

            ub.Margin = new Thickness(5, height + 5, 0, 0);
            ub.MouseLeftButtonDown += UserChange;
            //ub.MouseRightButtonDown += UserChange;
            canvas.Children.Add(ub);
            AddBoxMove();
            double h = add.Margin.Top + add.Height + 5;

            if (h < 677)
            {
                canvas.Height = h;
            }
        }
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            u = new User(UserBox.GetLineText(0), PwBox.Password);

            if (!Reg_success.Content.Equals(""))
            {
                Error.Content       = "";
                Reg_success.Content = "";
            }
            if (UserBox.GetLineText(0).Length == 0 && PwBox.Password.Length == 0)
            {
                Error.Content = "Login information missing";
            }
            else if (UserBox.GetLineText(0).Length == 0)
            {
                Error.Content = "Missing username";
            }

            else if (PwBox.Password.Length == 0)
            {
                Error.Content = "Missing Password";
            }
            else
            {
                if (existance(u))
                {
                    GlowingEarth ge = GlowingEarth.getInstance();
                    this.Close();
                    ge.Show();
                }
                else
                {
                    Error.Content = "Wrong username or password";
                }
            }
        }
Exemple #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SevenButton_Click(object sender, EventArgs e)
 {
     UserBox.AppendText(sevenButton.Text);
 }
Exemple #20
0
 private void EightButton_Click(object sender, EventArgs e)
 {
     UserBox.AppendText(eightButton.Text);
 }
Exemple #21
0
 private void NineButton_Click(object sender, EventArgs e)
 {
     UserBox.AppendText(nineButton.Text);
 }
Exemple #22
0
 private void ZeroButton_Click(object sender, EventArgs e)
 {
     UserBox.AppendText(zeroButton.Text);
 }
Exemple #23
0
        private void UserBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Return)
            {
                if (_tempCount < Entrycollectionsize && UserBox.Text != string.Empty && _tempVars[_tempCount] != string.Empty)
                {
                    //Console.WriteLine(_tempVars[_tempCount] + @" " + _tempCount);
                    while (_tempVars[_tempCount] != null)
                    {
                        _tempCount++;
                    }

                    _tempVars[_tempCount] = UserBox.Text;
                    _tempCount++;
                }

                AppendDebugLine(Environment.NewLine + UserBox.Text, Color.FromRgb(51, 153, 255));

                if (!UserBox.Text.Contains("start"))
                {
                    AppendDebugLine(Rcon.DewCmd(UserBox.Text), Color.FromRgb(150, 150, 150));
                }

                if (UserBox.Text.Contains("start"))
                {
                    string start = UserBox.Text.Replace("start ", string.Empty) + @"\eldorado.exe";

                    var startInfo = new ProcessStartInfo
                    {
                        FileName  = @start,
                        Arguments = "-launcher"
                    };

                    try
                    {
                        Process.Start(startInfo);
                    }
                    catch
                    {
                        AppendDebugLine("Could not find eldorado.exe is the path correct?" + Environment.NewLine, Color.FromRgb(255, 255, 0));
                    }
                }

                UserBox.Clear();
                DebugLog.ScrollToEnd();
            }


            if (e.Key == Key.Up)
            {
                int temp = _tempCount - 1;
                if (temp >= 0)
                {
                    Console.WriteLine(_tempVars[temp] + @" " + temp);
                    UserBox.Clear();
                    UserBox.Text       = _tempVars[temp];
                    UserBox.CaretIndex = UserBox.Text.Length;
                    _tempCount--;
                }
                else
                {
                    Console.WriteLine(@"Can't go up (Last entry)");
                }
            }

            if (e.Key == Key.Down)
            {
                int temp = _tempCount + 1;
                if (temp < Entrycollectionsize && _tempVars[temp - 1] != null)
                {
                    Console.WriteLine(_tempVars[temp] + @" " + temp);
                    UserBox.Clear();
                    UserBox.Text       = _tempVars[temp];
                    UserBox.CaretIndex = UserBox.Text.Length;
                    _tempCount++;
                }
                else
                {
                    Console.WriteLine(@"Can't go down (First entry)");
                }
            }
        }
Exemple #24
0
 public IActionResult Users()
 {
     ViewBag.UserList = UserBox.GetUsers();
     return(View());
 }
Exemple #25
0
 public Login()
 {
     InitializeComponent();
     UserBox.Focus();
 }
Exemple #26
0
 /// <summary>
 /// this menu clears the TextBox
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Remove_Click(object sender, RoutedEventArgs e)
 {
     Name = "";
     UserBox.Clear();
 }
Exemple #27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FourButton_Click(object sender, EventArgs e)
 {
     UserBox.AppendText(fourButton.Text);
 }
 public string getUser()
 {
     return(UserBox.GetLineText(0));
 }
 private void ClnBtn_Click(object sender, EventArgs e)
 {
     UserBox.Clear();
     OutputLabel.Text = "Input";
 }