예제 #1
0
파일: Form1.cs 프로젝트: dhcntt/DoAnC-UIT
        public Form1(Dangnhap _dangnhapTemp, int stt, string _userTemp, string Email, Image _imageTemp, string status, ClientManager ClientTemp)
        {
            InitializeComponent();
            _dangnhapForm = _dangnhapTemp;
            _stt = stt;
            _email = Email;
            _userName = _userTemp;
            client = ClientTemp;
            lbl_user.Text = _userName;
            Image RoundedImage = this.RoundCorners(_imageTemp, 55, Color.Transparent);
            ptb_avatar.Image = RoundedImage;
            _image = _imageTemp;
            _status = status;
            if (status == "\n")
            {
                txt_status.Text = "Bạn đang nghĩ gì.... 	";
            }
            else
                txt_status.Text = status;

            var pic = new Bitmap(this.bbt_addfriend.BackgroundImage, new Size(this.bbt_addfriend.Width, this.bbt_addfriend.Height));
            this.bbt_addfriend.BackgroundImage = pic;
            var picture = new Bitmap(this.bbt_notice.BackgroundImage, new Size(this.bbt_notice.Width, this.bbt_notice.Height));
            this.bbt_notice.BackgroundImage = picture;
            var picture1 = new Bitmap(this.bbt_check.BackgroundImage, new Size(this.bbt_notice.Width, this.bbt_notice.Height));
            this.bbt_check.BackgroundImage = picture1;
            Rectangle r = Screen.PrimaryScreen.WorkingArea;
            this.StartPosition = FormStartPosition.Manual;
            this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);
        }
예제 #2
0
 public FindFriend(ClientManager clientTemp, string _userTemp,Form1 frm_mainTemp)
 {
     InitializeComponent();
     client = clientTemp;
     client.ff_Form = this;
     _username = _userTemp;
     frm_main = frm_mainTemp;
 }
예제 #3
0
파일: Chat.cs 프로젝트: dhcntt/DoAnC-UIT
 public Chat(ClientManager ClientTemp,string userReferrence)
 {
     InitializeComponent();
     _client = ClientTemp;
     //_usernameMain = usermain;
     _usernameReference = userReferrence;
     _fontMessage = new Font("Microsoft Sans Serif", 10F, FontStyle.Regular);
     weight = this.Width;
     hight = this.Height;
 }
예제 #4
0
 public Personal_information(int Stt, string account, string Email, string status, Image image_,ClientManager clientTemp)
 {
     InitializeComponent();
     client = clientTemp;
     txt_ID.Text = Stt.ToString();
     txt_username.Text = account;
     txt_email.Text = Email.Trim();
     txt_status.Text = status;
     ptb_avatar.Image = image_;
 }
예제 #5
0
        void Click_dangnhap()
        {
            this.txt_dangnhap._lost();
            this.txt_password._lost();
            if (txt_dangnhap.NullText == false || txt_password.NullText == false)
            {
                MessageCustom.Show("Vui lòng nhập tài khoản và mật khẩu \n chính xác  để đăng nhập! ","Thông báo đăng nhập",new Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))));

            }
            else
            {
                try
                {
                    if ( client == null)
                    {
                        socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                        IPep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9999);
                        socket.Connect(IPep);
                        client = new ClientManager(this, socket);
                        stream = new NetworkStream(socket);
                    }

                    byte[] buffer = new byte[4];
                    buffer = BitConverter.GetBytes((int)CommandType_.Login);
                    stream.Write(buffer, 0, 4);
                    stream.Flush();
                    buffer = BitConverter.GetBytes(txt_dangnhap.Text.Length);
                    stream.Write(buffer, 0, 4);
                    stream.Flush();
                    byte[] data = new byte[txt_dangnhap.Text.Length];
                    data = Encoding.ASCII.GetBytes(txt_dangnhap.Text);
                    stream.Write(data, 0, txt_dangnhap.Text.Length);
                    stream.Flush();
                    buffer = BitConverter.GetBytes(txt_password.Text.Length);
                    stream.Write(buffer, 0, 4);
                    stream.Flush();
                    data = new byte[txt_password.Text.Length];
                    data = Encoding.ASCII.GetBytes(txt_password.Text);
                    stream.Write(data, 0, txt_password.Text.Length);
                    stream.Flush();
                }
                catch
                {
                    MessageCustom.Show("Server đang bảo trì. \nVui lòng đăng nhập lại sau. ", "Thông báo đăng nhập", new Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
                }
            }
        }
예제 #6
0
파일: Notice.cs 프로젝트: dhcntt/DoAnC-UIT
 public Notice(int stt, string userPrimary, string userReference, string type, string time, ClientManager _clientTemp)
 {
     InitializeComponent();
     _userPrimary = userPrimary;
     _userReference = userReference;
     client = _clientTemp;
     _stt = stt;
     lbl_time.Text = time;
     _type = type;
     if (_type == "1")
         lbl_content.Text = userReference.Trim() + " đã gởi lời mời kết bạn!";
     if (_type == "2")
     {
         lbl_content.Text = userReference.Trim() + " đã đồng ý kết bạn!";
         bbt_ok.Visible = false;
     }
     if (_type == "3")
     {
         lbl_content.Text = userReference.Trim() + " đã gởi cho bạn 1 tin nhắn!";
         bbt_ok.Visible = false;
     }
 }
예제 #7
0
파일: Friend.cs 프로젝트: dhcntt/DoAnC-UIT
 public Friend(string UserFriend, Image _imageTemp, bool status, ClientManager clientTemp, int _positionTemp = 0, string TextStatus = "")
 {
     InitializeComponent();
     Position = _positionTemp;
     _userFriend = UserFriend;
     client = clientTemp;
     if (Position % 2 == 0)
     {
         this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(5)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
         pictureBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
     }
     else
     {
         this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
         pictureBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
     }
     _textStatus = TextStatus;
     ptb_avatar.Image = _imageTemp;
     if (status)
         ptb_status.Image = global::Client_UIT.Properties.Resources.online;
     else
         ptb_status.Image = global::Client_UIT.Properties.Resources.offline;
 }
예제 #8
0
 /// <summary>
 /// ptb_dangki
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ptb_dangki_Click(object sender, EventArgs e)
 {
     try
     {
         if (client==null)
         {
             socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
             IPep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9999);
             socket.Connect(IPep);
             stream = new NetworkStream(socket);
             client = new ClientManager(this, socket);
         }
         Register dangki = new Register(socket);
         dangki.Show();
     }
     catch
     {
         MessageCustom.Show("Server đang bảo trì. \nBạn không thể đăng kí lúc này. ", "Thông báo đăng nhập", new Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
     }
 }
예제 #9
0
 public Form_Notice(ClientManager ClientTemp)
 {
     InitializeComponent();
     client = ClientTemp;
 }
예제 #10
0
 public Chat(ClientManager ClientTemp)
 {
     InitializeComponent();
     _client = ClientTemp;
     _fontMessage = new Font("Microsoft Sans Serif", 10F, FontStyle.Regular);
 }
예제 #11
0
파일: Notice.cs 프로젝트: dhcntt/DoAnC-UIT
 public Notice(int stt, string userPrimary, string userReference, string type, string time, ClientManager _clientTemp)
 {
     InitializeComponent();
     _userPrimary   = userPrimary;
     _userReference = userReference;
     client         = _clientTemp;
     _stt           = stt;
     lbl_time.Text  = time;
     _type          = type;
     if (_type == "1")
     {
         lbl_content.Text = userReference.Trim() + " đã gởi lời mời kết bạn!";
     }
     if (_type == "2")
     {
         lbl_content.Text = userReference.Trim() + " đã đồng ý kết bạn!";
         bbt_ok.Visible   = false;
     }
     if (_type == "3")
     {
         lbl_content.Text = userReference.Trim() + " đã gởi cho bạn 1 tin nhắn!";
         bbt_ok.Visible   = false;
     }
 }
예제 #12
0
        void Click_dangnhap()
        {
            panel1.Visible = false;
            panel2.Visible = true;
            progressBar1.Maximum = 100;
            progressBar1.Step = 1;
            progressBar1.Value = 0;
            //backgroundWorker = new BackgroundWorker();
            //backgroundWorker.DoWork+=backgroundWorker_DoWork;
            //backgroundWorker.WorkerReportsProgress = true;
            //backgroundWorker.WorkerSupportsCancellation = true;
            //backgroundWorker.ProgressChanged+=backgroundWorker_ProgressChanged;
            //backgroundWorker.RunWorkerAsync();
            this.txt_password._lost();
            this.txt_dangnhap._lost();
            if (txt_password.NullText == false || txt_dangnhap.NullText == false)
            {
                MessageCustom.Show("Vui lòng nhập tài khoản và mật khẩu \n chính xác  để đăng nhập! ","Thông báo đăng nhập",new Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
                panel1.Visible = true;
                panel2.Visible = false;

            }
            else
            {
                try
                {
                    if ( client == null)
                    {
                        socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                        IPep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9999);
                        socket.Connect(IPep);
                        client = new ClientManager(this, socket);
                        stream = new NetworkStream(socket);
                    }

                    byte[] buffer = new byte[4];
                    buffer = BitConverter.GetBytes((int)CommandType_.Login);
                    stream.Write(buffer, 0, 4);
                    stream.Flush();

                    buffer = BitConverter.GetBytes(txt_dangnhap.Text.Length);
                    stream.Write(buffer, 0, 4);
                    stream.Flush();
                    byte[] data = new byte[txt_dangnhap.Text.Length];
                    data = Encoding.ASCII.GetBytes(txt_dangnhap.Text);
                    stream.Write(data, 0, txt_dangnhap.Text.Length);
                    stream.Flush();

                    buffer = BitConverter.GetBytes(txt_password.Text.Length);
                    stream.Write(buffer, 0, 4);
                    stream.Flush();
                    data = new byte[txt_password.Text.Length];
                    data = Encoding.ASCII.GetBytes(txt_password.Text);
                    stream.Write(data, 0, txt_password.Text.Length);
                    stream.Flush();
                }
                catch
                {
                    MessageCustom.Show("Server đang bảo trì. \nVui lòng đăng nhập lại sau. ", "Thông báo đăng nhập", new Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
                    panel1.Visible = true;
                    panel2.Visible = false;
                }
            }
        }
예제 #13
0
파일: Form1.cs 프로젝트: dhcntt/DoAnC-UIT
        private void bbt_check_Click(object sender, EventArgs e)
        {
            checkFormClose = false;
            _dangnhapForm.Client._check = false;
            _dangnhapForm.Client = null;
            this.client = null;

            _dangnhapForm.socket.Close();
            this.Close();
            _dangnhapForm.LoadPanel();
            _dangnhapForm.Show();
        }
예제 #14
0
 public Form_Notice(ClientManager ClientTemp)
 {
     InitializeComponent();
     client = ClientTemp;
 }
예제 #15
0
 public Chat(ClientManager ClientTemp)
 {
     InitializeComponent();
     _client      = ClientTemp;
     _fontMessage = new Font("Microsoft Sans Serif", 10F, FontStyle.Regular);
 }
예제 #16
0
 public Personal_information(int Stt, string account, string Email, string status, Image image_, ClientManager clientTemp)
 {
     InitializeComponent();
     client            = clientTemp;
     txt_ID.Text       = Stt.ToString();
     txt_username.Text = account;
     txt_email.Text    = Email.Trim();
     txt_status.Text   = status;
     ptb_avatar.Image  = image_;
 }