Ejemplo n.º 1
0
 private void addMetricToolStripMenuItem_Click(object sender, EventArgs e)
 {
     toolStripStatusLabel1.Text = "Adding metric...";
     Form7 f7 = new Form7();
     f7.ShowDialog(this);
     dataGridView3_ReadMetrics();
     toolStripStatusLabel1.Text = "Working...";
 }
Ejemplo n.º 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            List <Student> l3 = new List <Student>();

            if (this.Tag != null)
            {
                l3 = (List <Student>) this.Tag;
            }
            if (lista_import.Count != 0)
            {
                foreach (Student s in lista_import)
                {
                    l3.Add(s);
                }
            }
            Form7 frm = new Form7();

            frm.Tag = l3;
            frm.ShowDialog();
            this.Close();
        }
Ejemplo n.º 3
0
        //Get Settings
        private void button_settings_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count <= 0)
            {
                MessageBox.Show("Please select a wocket");
                return;
            }

            label_status.Text       = "Loading Wocket...";
            button_settings.Enabled = false;
            Application.DoEvents();


            DataGridViewRow selected_row          = this.dataGridView1.SelectedRows[0];
            int             selected_device_index = selected_row.Index;

            WocketForm = new Form7((BluetoothDeviceInfo)bluetoothlist[selected_device_index]);
            WocketForm.Show();

            label_status.Text       = "Wocket Loaded...";
            button_settings.Enabled = true;
        }
Ejemplo n.º 4
0
        static void ReceiveData(TcpClient client)
        {
            NetworkStream ns = client.GetStream();

            byte[] receivedBytes = new byte[1024];
            int    byte_count;

            while (ns.CanRead == true)
            {
                while (ns.DataAvailable)
                {
                    //MessageBox.Show("New data");
                    while ((byte_count = ns.Read(receivedBytes, 0, receivedBytes.Length)) > 0)
                    {
                        string data = Encoding.ASCII.GetString(receivedBytes, 0, byte_count);

                        if (data.Contains("disable"))
                        {
                            if (isenabled == true)
                            {
                                isenabled = false;
                            }
                            else
                            {
                                isenabled = true;
                            }
                        }

                        if (data.Contains("notif"))
                        {
                            string[] splitter = data.Split('|');
                            MessageBox.Show(splitter[1]);
                        }
                        //else if (data.Contains("SendMessageSuccess"))
                        //{
                        //    string[] splitter = data.Split('|');

                        //    Form7 frm = new Form7();
                        //    frm.addOutMessage(splitter[1], Me.username);
                        //}


                        else if (data.Contains("NewMessage"))
                        {
                            //MessageBox.Show("nouveau message");
                            string[]    splitter = data.Split('|');
                            string      content  = splitter[1];
                            string      auteur   = splitter[2];
                            ChatMessage c        = new ChatMessage(content, auteur);
                            ChatMessage.mlist.Add(c);
                        }
                        else if (data.Contains("quit") || data.Contains("quitall"))
                        {
                            Application.Exit();
                        }
                        else if (data.Contains("OP"))
                        {
                            try
                            {
                                string[] splitter = data.Split('|');
                                onlineplayers = int.Parse(splitter[1]);
                                onlinegroups  = int.Parse(splitter[2]);
                            }
                            catch
                            {
                            }
                        }
                        else if (data.Contains("disconnectsuccess"))
                        {
                            f3todo = "destroy";
                            todo   = "destroy";
                            f4todo = "destroy";
                            f7todo = "destroy";
                        }
                        else if (data.Contains("regsuccess"))
                        {
                            SendToConnect();
                            f3todo = "destroy";
                        }
                        else if (data.Contains("regfailed"))
                        {
                            MessageBox.Show("Identifiants / Email déjà pris");
                        }

                        else if (data.Contains("authsuccess"))
                        {
                            string[] splitter = data.Split('|');
                            Me.rank = splitter[1];
                            new Thread(() =>
                            {
                                Form4 frm = new Form4();
                                frm.ShowDialog();
                            }).Start();
                            byte[] b = Encoding.ASCII.GetBytes("GetGroups");
                            SocketMain.SendData(b, SocketMain.ns);
                            todo = "destroy";
                        }
                        else if (data.Contains("PlayerKicked"))
                        {
                            foreach (User u in User.users)
                            {
                                string[] splitter = data.Split('|');
                                if (u.usernem == splitter[1])
                                {
                                    User.users.Remove(u);
                                    break;
                                }
                            }
                        }
                        else if (data.Contains("RoomDisbanded"))
                        {
                            User.users.Clear();
                            f4todo = "keep";
                            new Thread(() =>
                            {
                                Form4 frm = new Form4();
                                frm.ShowDialog();
                            }).Start();
                            byte[] b = Encoding.ASCII.GetBytes("GetGroups");
                            SocketMain.SendData(b, SocketMain.ns);
                            f7todo = "destroy";
                        }
                        else if (data.Contains("RoomKicked"))
                        {
                            string[] splitter = data.Split('|');
                            string   admin    = splitter[1];
                            f4todo = "keep";
                            new Thread(() =>
                            {
                                Form4 frm = new Form4();
                                frm.ShowDialog();
                            }).Start();


                            byte[] b = Encoding.ASCII.GetBytes("GetGroups");
                            SocketMain.SendData(b, SocketMain.ns);
                            f7todo = "destroy";
                            MessageBox.Show("Vous vous êtes fait exclure par " + admin);
                        }
                        else if (data.Contains("authbanned"))
                        {
                            MessageBox.Show("Ce compte à été banni de façon permanente de la plateforme QGF");
                        }
                        else if (data.Contains("authfailed"))
                        {
                            MessageBox.Show("Impossible de se connecter avec ces identifiants");
                        }
                        else if (data.Contains("RoomFull"))
                        {
                            MessageBox.Show("Salon Plein");
                        }
                        else if (data.Contains("JoinSuccess"))
                        {
                            string[] splitter = data.Split('|');
                            //JoinSuccess|user1/premium;user2/free;user3/free;|roomtitle|roomdesc|author
                            if (splitter[5] == Me.username)
                            {
                                if (splitter[1] != "")
                                {
                                    string[] users = splitter[1].Split(';');
                                    foreach (string u in users)
                                    {
                                        string[] ranks = u.Split('/');
                                        try
                                        {
                                            User user = new User(ranks[0], ranks[1]);
                                            User.users.Add(user);
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }

                                Me.currentroomname  = splitter[2];
                                Me.currentroomdesc  = splitter[3];
                                Me.currentroomadmin = splitter[4];
                                Me.currentroom      = int.Parse(splitter[6]);
                            }
                            new Thread(() =>
                            {
                                Form7 frm = new Form7();
                                frm.ShowDialog();
                            }).Start();

                            f4todo = "destroy";
                        }
                        else if (data.Contains("PlayerDisconnect"))
                        {
                            string[] splitter = data.Split('|');
                            string   username = splitter[1];
                            foreach (User u in User.users)
                            {
                                if (u.usernem == username)
                                {
                                    if (u.usernem == Me.currentroomadmin)
                                    {
                                    }
                                    User.users.Remove(u);
                                }
                            }
                        }
                        else if (data.Contains("PlayerJoined"))
                        {
                            bool got = false;
                            try
                            {
                                string[] splitter = data.Split('|');
                                data.Trim();
                                int i = int.Parse(splitter[3]);
                                if (i == Me.currentroom && splitter[1] != Me.username)
                                {
                                    // MessageBox.Show("oui" + Me.username);
                                    string username = splitter[1];
                                    string rank     = splitter[2];
                                    User   u        = new User(username, rank);
                                    foreach (User us in User.users)
                                    {
                                        if (us.usernem.Contains(username))
                                        {
                                            got = true;
                                        }
                                    }
                                    if (got == false)
                                    {
                                        User.users.Add(u);
                                    }
                                }
                            }


                            catch
                            {
                            }
                        }
                        else if (data.Contains("Groups"))
                        {
                            Group.g.Clear();

                            try {
                                string[] splitter = data.Split(';'); // sépare les groupes
                                if (splitter[0] != "Groups|")
                                {
                                    splitter[0].Replace("Groups|", "");

                                    foreach (string s in splitter)
                                    {
                                        if (s.Contains("Groups|"))
                                        {
                                            string[] split        = s.Split('|');
                                            string   author       = split[1];
                                            int      actualplayer = int.Parse(split[2]);
                                            int      maxplayers   = int.Parse(split[3]);
                                            string   _public      = split[4];

                                            string gameID   = split[8];
                                            string roomname = split[5];
                                            string roomdesc = split[6];
                                            int    roomid   = int.Parse(split[7]);
                                            string game     = Game.GetNameByID(gameID);

                                            try
                                            {
                                                string rank = split[9];
                                                Group  g    = new Group(roomname, roomdesc, author, actualplayer, maxplayers, game, _public, roomid, rank);
                                                Group.g.Add(g);
                                            }
                                            catch
                                            {
                                                Group g = new Group(roomname, roomdesc, author, actualplayer, maxplayers, game, _public, roomid, "free");


                                                Group.g.Add(g);
                                            }
                                        }
                                        if (!s.Contains("Groups|") && s != "")
                                        {
                                            try
                                            {
                                                string[] split        = s.Split('|');
                                                string   author       = split[0];
                                                int      actualplayer = int.Parse(split[1]);
                                                int      maxplayers   = int.Parse(split[2]);
                                                string   ispublic     = split[3];
                                                string   roomname     = split[4];
                                                string   roomdesc     = split[5];
                                                int      roomid       = int.Parse(split[6]);
                                                string   gameID       = split[7];
                                                string   rank         = split[8];
                                                string   game         = Game.GetNameByID(gameID);

                                                Group g = new Group(roomname, roomdesc, author, actualplayer, maxplayers, game, ispublic, roomid, rank);
                                                Group.g.Add(g);
                                            }
                                            catch
                                            {
                                                try
                                                {
                                                    string[] split        = s.Split('|');
                                                    string   author       = split[1];
                                                    int      actualplayer = int.Parse(split[2]);
                                                    int      maxplayers   = int.Parse(split[3]);
                                                    string   _public      = split[4];

                                                    string gameID   = split[8];
                                                    string roomname = split[5];
                                                    string roomdesc = split[6];
                                                    int    roomid   = int.Parse(split[7]);
                                                    string game     = Game.GetNameByID(gameID);

                                                    try
                                                    {
                                                        string rank = split[9];
                                                        Group  g    = new Group(roomname, roomdesc, author, actualplayer, maxplayers, game, _public, roomid, rank);

                                                        Group.g.Add(g);
                                                    }
                                                    catch
                                                    {
                                                        Group g = new Group(roomname, roomdesc, author, actualplayer, maxplayers, game, _public, roomid, "free");

                                                        Group.g.Add(g);
                                                    }
                                                }
                                                catch
                                                {
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                MessageBox.Show(e.ToString());
                            }
                        }

                        else
                        {
                            MessageBox.Show("Message inconnu: " + data);
                        }
                    }
                    Application.Exit();
                }
            }
        }
Ejemplo n.º 5
0
        private void button7_Click(object sender, EventArgs e)
        {
            Form7 f1 = new Form7();

            f1.Show();
        }
Ejemplo n.º 6
0
        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            Form7 t = new Form7();

            sayfa_getir(t);
        }
Ejemplo n.º 7
0
        private void LocaçãoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form7 formLocacao = new Form7();

            formLocacao.ShowDialog();
        }
Ejemplo n.º 8
0
        private void button5_Click(object sender, EventArgs e)
        {
            Form7 f7 = new Form7();

            f7.ShowDialog();
        }
Ejemplo n.º 9
0
        private void signupbtn_Click_1(object sender, EventArgs e)
        {
            Regex regex = new Regex(@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");

            if (string.IsNullOrEmpty(firstnametxt.Text) == true)
            {
                firstnametxt.Focus();
                errorProvider1.SetError(this.firstnametxt, "Shëno emrin tend!");
            }
            else if (string.IsNullOrEmpty(lastnametxt.Text) == true)
            {
                lastnametxt.Focus();
                errorProvider2.SetError(this.lastnametxt, "Shëno mbiemrin tend!");
            }
            else if (emailtxt == null)
            {
                MessageBox.Show("Jepeni email tuaj.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (checkBox1.Checked != true)
            {
                checkBox1.Focus();
                errorProvider6.SetError(this.checkBox1, "A i pranon kushtet tona?");
            }
            else if (string.IsNullOrEmpty(textBox1.Text) == true)
            {
                textBox1.Focus();
                errorProvider7.SetError(this.textBox1, "Jepeni çmimin e produktit.");
            }
            else if (pictureBox1.Image == null)
            {
                pictureBox1.Focus();
                errorProvider8.SetError(this.shtobtn, "Shto produktin!");
            }
            else
            {
                MemoryStream ms = new MemoryStream();
                pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
                byte[] img         = ms.ToArray();
                String insertQuery = "INSERT INTO signup(emri,mbiemri,adresa,email,foto,çmimi) VALUES (@emri,@mbiemri,@adresa, @email, @img, @çmimi)";
                connect.Open();

                con = new MySqlCommand(insertQuery, connect);

                con.Parameters.Add("@emri", MySqlDbType.VarChar, 30);
                con.Parameters.Add("@mbiemri", MySqlDbType.VarChar, 30);
                con.Parameters.Add("@adresa", MySqlDbType.VarChar, 30);
                con.Parameters.Add("@email", MySqlDbType.VarChar, 30);
                con.Parameters.Add("@img", MySqlDbType.LongBlob);
                con.Parameters.Add("@çmimi", MySqlDbType.Int32, 11);

                con.Parameters["@emri"].Value    = firstnametxt.Text;
                con.Parameters["@mbiemri"].Value = lastnametxt.Text;
                con.Parameters["@adresa"].Value  = addresstxt.Text;
                con.Parameters["@email"].Value   = emailtxt.Text;
                con.Parameters["@img"].Value     = img;
                con.Parameters["@çmimi"].Value   = textBox1.Text;

                if (con.ExecuteNonQuery() == 1)
                {
                    Form7 f7 = new Form7();
                    f7.ShowDialog();
                }
                connect.Close();
                firstnametxt.Text = lastnametxt.Text = emailtxt.Text = addresstxt.Text = textBox1.Text = " ";
                pictureBox1.Image = null;
            }
        }
Ejemplo n.º 10
0
        private void button16_Click(object sender, EventArgs e)
        {
            if (label25.Text == "")
            {
                MessageBox.Show("������� ����� ��� �������� �������� ��������!");
                return;
            }

            Form7 f7 = new Form7(ReaderRecordFormular);
            f7.ShowDialog();
        }
Ejemplo n.º 11
0
        // xem thống kê
        private void Thongkef2_Click(object sender, EventArgs e)
        {
            Form7 Frm7 = new Form7(IDtext.Text);

            Frm7.Show();
        }