private void RenameButton_Click(object sender, EventArgs e) { if (CharListView.SelectedItems.Count > 0) { ListViewItem item = CharListView.SelectedItems[0]; if (item.Tag != null) { AddForm add = new AddForm(item.Text, "Введите новое имя."); add.ShowDialog(this); if (Configer.Tmp != "" && Configer.Tmp != item.Text) { if (File.Exists(Path.Combine(Path.Combine(_profile.Name, item.Tag.ToString()), Configer.Tmp) + ".wav")) { MessageBox.Show("Звук с таким именем уже существует."); return; } File.Move(Path.Combine(Path.Combine(_profile.Name, item.Tag.ToString()), item.Text) + ".wav", Path.Combine(Path.Combine(_profile.Name, item.Tag.ToString()), Configer.Tmp) + ".wav"); Configer.LoadProfile(_profile, _profile.Name); item.Text = Configer.Tmp; item.ToolTipText = item.Text; CharListView.Sort(); } } } }
protected void DropDownList1_Load(object sender, EventArgs e) { String temp = DropDownList1.SelectedValue; DataTable dt = new DataTable(); MySqlConnection connection = new MySqlConnection("Database=gameserver_beta;Data Source=localhost;User Id=root;Password=admin"); connection.Open(); String cmd = "SELECT * FROM characters WHERE char_name=@flag"; MySqlDataAdapter da = new MySqlDataAdapter(cmd, connection); da.SelectCommand.Parameters.AddWithValue("@flag", temp); da.Fill(dt); DataRow[] rows = dt.Select(); maxcp = Convert.ToSingle(rows[0]["maxCP"]); curcp = Convert.ToSingle(rows[0]["curCP"]); maxhp = Convert.ToSingle(rows[0]["maxHP"]); curhp = Convert.ToSingle(rows[0]["curHP"]); maxmp = Convert.ToSingle(rows[0]["maxMP"]); curmp = Convert.ToSingle(rows[0]["curMP"]); race = Convert.ToInt16(rows[0]["race"]); sex = Convert.ToInt16(rows[0]["sex"]); CharListView.DataSource = dt; CharListView.DataBind(); connection.Close(); }
private void fillMediaList(string type) { CharListView.Clear(); string[] media = Chars.GetSoundsByTypes(type); for (int i = 0; i < media.Length; i++) { ListViewItem item = new ListViewItem(media[i]); item.Tag = null; item.Name = media[i]; CharListView.Items.Add(item); SetCharBoxItemColor(i); } }
private void fillSpecificMediaList(string type) { CharListView.Clear(); AddSoundButton.Enabled = true; string[] media = _profile.GetSpecificSoundsByType(type); for (int i = 0; i < media.Length; i++) { ListViewItem item = new ListViewItem(media[i]); item.ToolTipText = item.Text; item.Tag = type; item.Name = media[i]; CharListView.Items.Add(item); SetCharBoxItemColor(i, true); } }
private void AddSoundButton_Click(object sender, EventArgs e) { string type = CharBox.SelectedItem.ToString(); AddForm add = new AddForm(type + CharListView.Items.Count.ToString()); add.ShowDialog(this); string name = Configer.Tmp; if (name != "") { _profile.AddSound(type, Configer.Tmp, null); if (record(name, type)) { fillSpecificMediaList(type); ListViewItem item = CharListView.Items.Find(name, false)[0]; item.Selected = true; item.ToolTipText = item.Text; CharListView.Focus(); } } }
// section choosed private void CharBox_SelectedIndexChanged(object sender, EventArgs e) { if (CharBox.SelectedItem == null) { return; } char [] cons = Chars.Consonents; //this.Width = WidthSmall; if (Chars.IsSoundType(CharBox.SelectedItem.ToString())) { fillMediaList(CharBox.SelectedItem.ToString()); } else { fillSpecificMediaList(CharBox.SelectedItem.ToString()); } CharListView.Focus(); if (CharListView.Items.Count > 0) { CharListView.Items[0].Selected = true; } CharsStatusLabel.Text = "Тип: " + CharBox.SelectedItem.ToString(); }