コード例 #1
0
        // 준비 버튼
        private void Game_Ready(object sender, EventArgs e)
        {
            int chk;

            for (int i = ClientBox.Items.Count - 1; i >= 0; i--)
            {
                if (connectUser == ClientBox.Items[i].ToString())
                {
                    if (ClientBox.GetItemCheckState(i) != CheckState.Checked)
                    {
                        ClientBox.SetItemCheckState(i, CheckState.Checked);
                        chk = 1;
                    }
                    else
                    {
                        ClientBox.SetItemCheckState(i, CheckState.Unchecked);
                        chk = 2;
                    }
                    if (ClientBox.CheckedItems.Count == ClientBox.Items.Count)
                    {
                        chk = 3;
                    }
                    string sendDt = connectUser + '\x01' + ClientBox.Items.Count.ToString() + '\x01' + chk + '\x01';
                    foreach (string cliList in ClientBox.Items)
                    {
                        sendDt += cliList + '\x01';
                    }
                    cliForm.recvDt   = sendDt;
                    cliForm.sendkind = 3;
                    cliForm.TalkSend();
                    break;
                }
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: OlegMell/Exam
        public MainWindow(ImgInfo imgInfo, string nickname, string ip, string port)
        {
            InitializeComponent();
            DataContext   = this;
            currentUser   = nickname;
            clientBuilder = new ClientBuilder(nickname, imgInfo, ip, port);
            clientBuilder.UpClientList += ClientBuilder_UpClientList;
            clientBuilder.UpMessage    += ClientBuilder_UpMessage;

            var clientBox = new ClientBox();

            clientBox.ClientName.Text          = "GROUP CHAT";
            clientBox.ProfileImage.ImageSource = new BitmapImage(new Uri(Path.GetFullPath(@"..\Debug\groupIcon.png")));
            ClientPanel.Children.Add(clientBox);
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: OlegMell/Exam
 private void ClientBuilder_UpClientList(List <Info> clients)
 {
     clients.ForEach((client) =>
     {
         if (!client.UserName.Equals(currentUser))
         {
             var clientBox             = new ClientBox();
             clientBox.NickName        = currentUser;
             clientBox.ClientInfo      = client;
             clientBox.MouseDown      += ClientBox_MouseDown;
             clientBox.ClientName.Text = currentUser;
             var path = Utilities.ConvertToImage(client.ProfileImg.Name, client.ProfileImg.Size);
             clientBox.ProfileImage.ImageSource = new BitmapImage(new Uri(Path.GetFullPath(path)));
             ClientPanel.Children.Add(clientBox);
         }
     });
 }
コード例 #4
0
ファイル: OrdersForm.cs プロジェクト: Baidullayev/Dias-diplom
        public void showMore()
        {
            ClientBox.Items.Clear();
            CarrierBox.Items.Clear();
            DestinationCityBox.Items.Clear();
            DepartureCityBox.Items.Clear();
            string record_id = this.dataGridView1.CurrentRow.Cells["order_id"].Value.ToString();

            //MessageBox.Show(record_id);

            //Получение списка клиентов

            if (record_id != "")
            {
                using (SqlConnection con = new SqlConnection(MainForm.connectionString))
                {
                    con.Open();

                    string     command = "select company_name from Clients";
                    SqlCommand cmd     = new SqlCommand(command, con);

                    SqlDataReader reader = cmd.ExecuteReader();

                    string[] arr = new string[5];
                    while (reader.Read())
                    {
                        ClientBox.Items.Add(reader["company_name"].ToString());
                    }
                    string company_name = this.dataGridView1.CurrentRow.Cells["client_name"].Value.ToString();
                    ClientBox.SelectedIndex = ClientBox.FindString(company_name);
                    con.Close();
                }


                //Получени списка перевозщиков
                using (SqlConnection con = new SqlConnection(MainForm.connectionString))
                {
                    con.Open();

                    string     command = "select carrier_name from Carriers";
                    SqlCommand cmd     = new SqlCommand(command, con);

                    SqlDataReader reader = cmd.ExecuteReader();

                    string[] arr = new string[5];
                    while (reader.Read())
                    {
                        CarrierBox.Items.Add(reader["carrier_name"].ToString());
                    }
                    string carrier_name = this.dataGridView1.CurrentRow.Cells["carrier_name"].Value.ToString();
                    CarrierBox.SelectedIndex = CarrierBox.FindString(carrier_name);
                    con.Close();
                }


                //Получение списка городов
                using (SqlConnection con = new SqlConnection(MainForm.connectionString))
                {
                    con.Open();

                    string     command = "select city_name from Cities";
                    SqlCommand cmd     = new SqlCommand(command, con);

                    SqlDataReader reader = cmd.ExecuteReader();

                    string[] arr = new string[5];
                    while (reader.Read())
                    {
                        DepartureCityBox.Items.Add(reader["city_name"].ToString());
                        DestinationCityBox.Items.Add(reader["city_name"].ToString());
                    }
                    string destination_city = this.dataGridView1.CurrentRow.Cells["destination_city"].Value.ToString();
                    DestinationCityBox.SelectedIndex = DestinationCityBox.FindString(destination_city);


                    string departure_city = this.dataGridView1.CurrentRow.Cells["departure_city"].Value.ToString();
                    DepartureCityBox.SelectedIndex = DepartureCityBox.FindString(departure_city);

                    con.Close();
                }

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                string order_status = this.dataGridView1.CurrentRow.Cells["order_status"].Value.ToString();
                statusBox.SelectedIndex = statusBox.FindString(order_status);
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                string load_type = this.dataGridView1.CurrentRow.Cells["load_type"].Value.ToString();
                loadTypeBox.SelectedIndex = loadTypeBox.FindString(load_type);
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                string carriage_type = this.dataGridView1.CurrentRow.Cells["carriage_type"].Value.ToString();
                carriageTypeBox.SelectedIndex = carriageTypeBox.FindString(carriage_type);
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                loadWeightBox.Text = this.dataGridView1.CurrentRow.Cells["load_weight"].Value.ToString();
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                loadVolumeBox.Text = this.dataGridView1.CurrentRow.Cells["load_volume"].Value.ToString();
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                loadNameBox.Text = this.dataGridView1.CurrentRow.Cells["load_name"].Value.ToString();
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                costBox.Text = this.dataGridView1.CurrentRow.Cells["cost"].Value.ToString();
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                DateTime order_date = Convert.ToDateTime(this.dataGridView1.CurrentRow.Cells["order_date"].Value.ToString());
                dateTimePicker1.Value = order_date;
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                orderId = Convert.ToInt32(this.dataGridView1.CurrentRow.Cells["order_id"].Value.ToString());
            }
        }