Ejemplo n.º 1
0
        private void Hello_MouseEnter(object sender, MouseEventArgs e)
        {
            while (k < 1)
            {
                k = 1;
                string           S***n   = Name.Text;
                DB               db      = new DB();
                DataTable        table   = new DataTable();
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                db.openConnection();



                MySqlCommand command = new MySqlCommand("SELECT `name`,`secondname`  FROM `users` WHERE  `login`=@lU", db.getConnection());
                command.Parameters.Add("@lU", MySqlDbType.VarChar).Value = S***n;

                using (MySqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var fname = reader["name"].ToString();
                        var sname = reader["secondname"].ToString();
                        Hello_User.Text = fname;
                        Name.Text       = sname;
                    }
                }

                db.closeConnection();


                Scroll_Menu.Visibility  = Visibility.Hidden;
                Scroll_Notes.Visibility = Visibility.Hidden;
                var awaiter = Task.Delay(2000).GetAwaiter();
                awaiter.OnCompleted(() =>
                {
                    Hello_1.Visibility     = Visibility.Hidden;
                    Hello_2.Visibility     = Visibility.Hidden;
                    Scroll_Menu.Visibility = Visibility.Visible;


                    awaiter = Task.Delay(0).GetAwaiter();
                });
            }
        }
Ejemplo n.º 2
0
        private void Button_Menu(object sender, RoutedEventArgs e)
        {
            Scroll_Notes.Visibility = Visibility.Visible;
            Scroll_Notes.Opacity    = 1;
            string UserName = Name.Text;

            DB               db      = new DB();
            DataTable        table   = new DataTable();
            MySqlDataAdapter adapter = new MySqlDataAdapter();

            db.openConnection();



            MySqlCommand command = new MySqlCommand("SELECT `login`, `post`  FROM `users` WHERE  `secondname`=@US", db.getConnection());

            command.Parameters.Add("@US", MySqlDbType.VarChar).Value = UserName;

            using (MySqlDataReader reader = command.ExecuteReader())
            {
                while (reader.Read())
                {
                    var userlogin = reader["login"].ToString();
                    var userpost  = reader["post"].ToString();
                    LoginMenu.Text += " " + userlogin;
                    RangMenu.Text  += " " + userpost;
                }
            }


            string appDir = Environment.CurrentDirectory;
            string Page   = appDir + "/Sound/Page.wav";

            _mpBgr.Open(new Uri(@Page, UriKind.Absolute));
            _mpBgr.Play();
            string user_sname = Name.Text;
            string user_fname = Hello_User.Text;



            if (s == 0)
            {
                s         += 1;
                user_sname = user_sname.ToUpper().Remove(1);
                user_fname = user_fname.ToUpper().Remove(1);
                i          = user_sname + user_fname;
            }


            if (this.Width == 300)
            {
                Name.Text              = i;
                this.Width             = 600;
                Menu.Width             = 300;
                Main.Margin            = new Thickness(300, 0, 0, 0);
                this.Left             -= 150;
                Scroll_Menu.Visibility = Visibility.Hidden;
            }
            else
            {
                Name.Text              = i;
                this.Width             = 1300;
                Menu.Width             = 300;
                Notes.Margin           = new Thickness(600, 0, 0, 0);
                Main.Margin            = new Thickness(300, 0, 0, 0);
                this.Left             -= 150;
                Scroll_Menu.Visibility = Visibility.Hidden;
            }
        }