public void RenameItem(object sender, EventArgs e) { if ((FileList.SelectedItems.Count == 0)) { MessageBox.Show(Program.LanguageManager.Translation.fileMsgNoSelect); return; } var input = new InputFrm("Rename", Program.LanguageManager.Translation.fileNewName, Program.LanguageManager.Translation.fileInputConfirm, "Cancel"); if ((!(FileList.SelectedItems.Count > 1))) { if ((input.ShowDialog() == DialogResult.OK)) { try { File.Copy(Program.Config.LauncherDir + m_fileLocation + FileList.Items[FileList.SelectedIndex] + m_fileType, Program.Config.LauncherDir + m_fileLocation + input.InputBox.Text + m_fileType); File.Delete(Program.Config.LauncherDir + m_fileLocation + FileList.Items[FileList.SelectedIndex] + m_fileType); RefreshFileList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } else { MessageBox.Show(Program.LanguageManager.Translation.fileMsbMulti, "Rename Error"); } }
public void LoadRoom(object sender, EventArgs e) { var rooms = (ListBox)sender; if (rooms.SelectedIndex == -1) { return; } if (!m_rooms.ContainsKey(rooms.SelectedItem.ToString())) { return; } RoomInfos item = m_rooms[rooms.SelectedItem.ToString()]; if (item.isRanked && !item.hasStarted) { MessageBox.Show("Cannot manually join a ranked game."); return; } if (item.isLocked) { var form = new InputFrm(string.Empty, Program.LanguageManager.Translation.GameEnterPassword, Program.LanguageManager.Translation.QuickHostBtn, Program.LanguageManager.Translation.optionBtnCancel) { InputBox = { MaxLength = 4 } }; if (!item.hasStarted) { if (form.ShowDialog() == DialogResult.OK) { if (form.InputBox.Text != item.roomName) { MessageBox.Show(Program.LanguageManager.Translation.GameWrongPassword); return; } } else { return; } } } if (Program.ServerList.ContainsKey(item.server)) { LauncherHelper.GenerateConfig(Program.ServerList[item.server], item.ToName()); LauncherHelper.RunGame("-j"); } }
private void AddThemeBtn_Click(object sender, EventArgs e) { var form = new InputFrm("Add Theme", "Enter theme name", "Add", "Cancel"); if (form.ShowDialog() == DialogResult.OK) { if (m_themes.ContainsKey(form.InputBox.Text)) { MessageBox.Show("Theme already exsists!", "Error", MessageBoxButtons.OK); return; } AddTheme(form.InputBox.Text); ThemeSelect.Items.Add(form.InputBox.Text); ThemeSelect.SelectedItem = form.InputBox.Text; } }
private void Getitem(object handler, EventArgs e) { bool input = (((Button)handler).Name[0].ToString(CultureInfo.InvariantCulture) == "1"); string servercommand = ((Button)handler).Name.Substring(1); if (input) { if (servercommand != "DEVCOLOR") { var form = new InputFrm("Input", m_descriptions[servercommand], "Confirm", "Cancel"); if (servercommand != "DEVCREATETEAM" && servercommand != "DEVMSG") { form.InputBox.KeyDown += Suppress_Space; } if (servercommand == "DEVCREATETEAM") { form.InputBox.MaxLength = 20; } else if (servercommand == "DEVMSG") { form.InputBox.MaxLength = 250; } else { form.InputBox.MaxLength = 14; } if (form.ShowDialog() == DialogResult.OK) { if (form.InputBox.Text == "") { MessageBox.Show("Input cannot be empty"); return; } Program.ChatServer.SendPacket(DevServerPackets.DevPointCommand, JsonSerializer.SerializeToString( new PacketCommand { Command = servercommand, Data = form.InputBox.Text.Trim() })); } } else { var selectcolor = new ColorDialog(); if (selectcolor.ShowDialog() == DialogResult.OK) { Program.ChatServer.SendPacket(DevServerPackets.DevPointCommand, JsonSerializer.SerializeToString( new PacketCommand { Command = servercommand, Data = selectcolor.Color.R + "," + selectcolor.Color.G + "," + selectcolor.Color.B })); } } } else { if (MessageBox.Show("Confirm", "Are you sure?", MessageBoxButtons.YesNo) == DialogResult.Yes) { Program.ChatServer.SendPacket(DevServerPackets.DevPointCommand, JsonSerializer.SerializeToString( new PacketCommand { Command = servercommand })); } } }