コード例 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public LoginWindow()
        {
            InitializeComponent();

            // Give textbox focus
            Password_TextBox.Focus();

            // Create the new data vault interface
            _dataVaultInterface = new DataVaultInterface();
        }
コード例 #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
#if DEBUG
            Topmost = false;
#else
            Hook.Start();
            using var key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
            key.SetValue("DisableTaskMgr", "1");
            key.Close();
#endif
            Picture.Delete();
            Profile_Image.ImageSource = ImageSourceFromBitmap(Properties.Resources.Profile_Default);
            Battery_Image.Source      = ImageSourceFromBitmap(Properties.Resources.Battery);
            var red    = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
            var yellow = new SolidColorBrush(Color.FromArgb(255, 255, 255, 0));
            var green  = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0));
            ThreadPool.QueueUserWorkItem((x) =>
            {
                while (timerT)
                {
                    Dispatcher.Invoke(() =>
                    {
                        Clock_Label_H.Content    = DateTime.Now.ToString("hh");
                        Clock_Label_M.Content    = DateTime.Now.ToString("mm");
                        Clock_Label_C.Visibility = Clock_Label_C.Visibility == Visibility.Visible ? Visibility.Hidden : Visibility.Visible;
                    });
                    Thread.Sleep(500);
                }
            });
            ThreadPool.QueueUserWorkItem((x) =>
            {
                while (batteryT)
                {
                    var battery = GetBatteryPercentage();
                    Dispatcher.Invoke(() =>
                    {
                        Battery_Gage.Fill          = battery <= 33 ? red : battery <= 66 ? yellow : green;
                        Battery_Percentage.Content = $"{battery}%";
                        Battery_Gage.Width         = battery * 0.73;
                    });
                    Thread.Sleep(60000);
                }
            });
            Password_TextBox.Focus();
        }
コード例 #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
#if !DEBUG
            if (string.IsNullOrEmpty(Settings.Default.Password))
            {
                new TermsOfUseWindow().ShowDialog();
            }
#endif
            Password_TextBox.Focus();
            Guid_Label.BeginAnimation(OpacityProperty, fade);
            Guid_Label.Content = "저는 루시드 드림의 사용을 도와주는\n도우미, 루시입니다.";
            var sw = new Stopwatch();
            sw.Start();
            for (; ;)
            {
                System.Windows.Forms.Application.DoEvents();
                Thread.Sleep(1);
                sw.Stop();
                if (sw.Elapsed.TotalSeconds >= 2)
                {
                    sw.Restart();
                    break;
                }
                sw.Start();
            }
            Guid_Label.BeginAnimation(OpacityProperty, fade);
            Guid_Label.Content = "제가 지시하는 대로 따라주세요.";
            for (; ;)
            {
                System.Windows.Forms.Application.DoEvents();
                Thread.Sleep(1);
                sw.Stop();
                if (sw.Elapsed.TotalSeconds >= 2)
                {
                    break;
                }
                sw.Start();
            }
            Guid_Label.BeginAnimation(OpacityProperty, trash);
            Password_TextBox.BeginAnimation(OpacityProperty, fade);
            Guid_Label.Content = "비밀번호를 입력하세요";
        }
コード例 #4
0
ファイル: Login.cs プロジェクト: Doantanphat310/BlueStarGroup
        private bool IsLogin()
        {
            string userID = UserID_TextBox.Text;

            if (string.IsNullOrWhiteSpace(userID))
            {
                MessageBoxHelper.ShowErrorMessage("Tên đăng nhập không được trống!");
                UserID_TextBox.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(Password_TextBox.Text))
            {
                MessageBoxHelper.ShowErrorMessage("Mật khẩu không được trống!");
                Password_TextBox.Focus();
                return(false);
            }

            using (UserController controller = new UserController())
            {
                Users user = controller.GetUsers()?.Find(o => o.UserID.ToUpper() == userID.ToUpper());

                if (user != null && ClientCommon.IsComparePass(Password_TextBox.Text, user.Password))
                {
                    SetUserInfo(user);

                    UserInfo.Companies = controller.GetUserCompany(UserInfo.UserID);

                    return(true);
                }
                else
                {
                    LoginCount++;
                    MessageBoxHelper.ShowErrorMessage("Tên đăng nhập hoặc mật khẩu không đúng!");
                    UserID_TextBox.Focus();
                    return(false);
                }
            }
        }
コード例 #5
0
        private void SignUp_btn_Click(object sender, EventArgs e)
        {
            try
            {
                if (ID_textbox.Text == string.Empty)
                {
                    MessageBox.Show("Empty ID Box", "Empty detected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    ID_textbox.Focus();
                }
                //check the signup name box if it's empty
                if (Name_TextBox.Text == string.Empty)
                {
                    MessageBox.Show("Empty Name Box", "Empty detected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Name_TextBox.Focus();
                }//check te signup password box if it's empty
                else if (Password_TextBox.Text == string.Empty)
                {
                    MessageBox.Show("Empty Password Box", "Empty detected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Password_TextBox.Focus();
                }
                else if (Email_textBox.Text == string.Empty)
                {//Check email box
                    MessageBox.Show("Please enter your email", "Email", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Email_textBox.Focus();
                }
                //check the digit of password
                else if (Password_TextBox.Text.Length < 8)
                {
                    MessageBox.Show("Hint: short password , password should be 8 digit or more ", "short password", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Password_TextBox.Focus();
                    Password_TextBox.SelectAll();
                }
                else if (ID_textbox.Text.Length < 9)
                {
                    MessageBox.Show("Hint: short ID , ID should 9 digit or more ", "Short user ID ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ID_textbox.Focus();
                    ID_textbox.SelectAll();
                }
                else
                {
                    //Enter new data  iin database
                    OnlineBankingSystemDBDataset.UsersRow row;
                    row = onlineBankingSystemDBDataset1.Users.NewUsersRow();

                    row.User_ID  = int.Parse(ID_textbox.Text);
                    User_ID      = int.Parse(ID_textbox.Text);
                    U_Name       = Name_TextBox.Text;
                    row.Name     = Name_TextBox.Text;
                    row.Email    = Email_textBox.Text;
                    row.Password = Password_TextBox.Text;
                    onlineBankingSystemDBDataset1.Users.Rows.Add(row);

                    this.usersTableAdapter.Update(onlineBankingSystemDBDataset1.Users);
                    if (usersTableAdapter.Check_data_Entry(Name_TextBox.Text) != null)
                    {
                        MessageBox.Show("Account created", "Account Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Cannot enter");
                    }
                }
            }
            catch (Exception data_signup)
            {
                MessageBox.Show(data_signup.Message, "Exception Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }