コード例 #1
0
        public void RenameItem(object sender, EventArgs e)
        {
            if ((FileList.SelectedItems.Count == 0))
            {
                MessageBox.Show("Nothing selected");
                return;
            }
            Input_frm input = new Input_frm("Rename", "Enter new name", "Rename", "Cancel");
            if ((!(FileList.SelectedItems.Count > 1)))
            {

                if ((input.ShowDialog() == DialogResult.OK))
                {
                    try
                    {
                        File.Copy(FileLocation + FileList.Items[FileList.SelectedIndex].ToString() + FileType, FileLocation + input.InputBox.Text + FileType);
                        File.Delete(FileLocation + FileList.Items[FileList.SelectedIndex].ToString() + FileType);
                        RefreshFileList();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            else
            {
                MessageBox.Show("Can't Rename multiple items", "Rename Error");

            }
        }
コード例 #2
0
        private void AddThemeBtn_Click(object sender, EventArgs e)
        {
            Input_frm form = new Input_frm("Add Theme", "Enter theme name", "Add", "Cancel");

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (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;
            }
        }
コード例 #3
0
        public void RenameItem(object sender, EventArgs e)
        {
            if ((FileList.SelectedItems.Count == 0))
            {
                MessageBox.Show(Program.LanguageManager.Translation.fileMsgNoSelect);
                return;
            }
            Input_frm input = new Input_frm("Rename", Program.LanguageManager.Translation.fileNewName, Program.LanguageManager.Translation.fileInputConfirm, "Cancel");
            if ((!(FileList.SelectedItems.Count > 1)))
            {

                if ((input.ShowDialog() == DialogResult.OK))
                {
                    try
                    {
                        File.Copy(FileLocation + FileList.Items[FileList.SelectedIndex].ToString() + FileType, FileLocation + input.InputBox.Text + FileType);
                        File.Delete(FileLocation + FileList.Items[FileList.SelectedIndex].ToString() + FileType);
                        RefreshFileList();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            else
            {
                MessageBox.Show(Program.LanguageManager.Translation.fileMsbMulti, "Rename Error");

            }
        }
コード例 #4
0
        public void LoadRoom(object sender, EventArgs e)
        {
            ListBox 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.isLocked)
            {
                Input_frm form = new Input_frm("", Program.LanguageManager.Translation.GameEnterPassword, Program.LanguageManager.Translation.QuickHostBtn, Program.LanguageManager.Translation.optionBtnCancel);
                form.InputBox.MaxLength = 4;
                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (form.InputBox.Text != item.RoomName)
                    {
                        MessageBox.Show(Program.LanguageManager.Translation.GameWrongPassword);
                        return;
                    }
                }
                else
                { return; }
            }

            if (item.Started)
            {
                MessageBox.Show("Spectating games in progress is unavailable.. Please join them before they start.");
                return;
            }
            LauncherHelper.GenerateConfig(item.GenerateURI(Program.Config.ServerAddress,Program.Config.GamePort));
            LauncherHelper.RunGame("-j");
        }