Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Kursovaya (1).docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
171.6 Кб
Скачать

Додаток а:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace Teamcomposition

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

form2 = new Form2();

}

Form2 form2;

private void button1_Click(object sender, EventArgs e)

{

this.Hide();

form2 = new Form2();

form2.Show();

}

private void button2_Click(object sender, EventArgs e)

{

this.Close();

}

}

}

Додаток в:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace Teamcomposition

{

public partial class Form2 : Form

{

public Form2()

{

InitializeComponent();

}

public class Team

{

public string name { get; set; }

public string type { get; set; }

public string text { get; set; }

public string text1 { get; set; }

}

public string commandText;

public string[] lines;

public string path;

Team team1 = new player();

public void left()

{

book1.name = textBox1.Text;

book1.type = listBox1.Text;

book1.text = richTextBox3.Text;

book1.text1 = richTextBox1.Text;

}

public void left2()

{

System.IO.File.WriteAllText(book1.type + "\\" + book1.name + ".txt", book1.text1);

System.IO.File.WriteAllText(book1.type + "\\" + book1.name + "1.txt", book1.text);

lines = System.IO.File.ReadAllLines(@"list.txt");

path = book1.type + "\\" + book1.name + "1.txt";

string[] lines1 = { book1.name + "\n" + book1.type + "\n" + path };

List<string> listwork = new List<string>();

listwork.AddRange(lines);

listwork.AddRange(lines1);

System.IO.File.WriteAllLines(@"list.txt", listwork);

}

public void find()

{

book1.name = textBox2.Text;

lines = System.IO.File.ReadAllLines(@"list.txt");

int count = System.IO.File.ReadAllLines("list.txt").Length;

for (int i = 0; i < count; i++)

{

if (team1.name == lines[i])

{

listBox2.Text = lines[i + 1]; richTextBox2.Text =

System.IO.File.ReadAllText(lines[i + 2]); path = listBox2.Text + "\\" + team1.name + ".txt";

richTextBox4.Text = path;

}

}

}

public void Openfile()

{

var proc = new System.Diagnostics.Process();

proc.StartInfo.FileName = commandText;

proc.StartInfo.UseShellExecute = true;

proc.Start();

}

playername1 playername 1;

private void button1_Click(object sender, EventArgs e)

{

this.Close();

form1 = new Form1();

form1.Show();

}

private void button2_Click(object sender, EventArgs e)

{

richTextBox4.Text = System.IO.File.ReadAllText("list.txt");

}

//mid but

private void button8_Click(object sender, EventArgs e)

{

}

#region leftblock

private void label4_Click(object sender, EventArgs e)

{

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

}

private void label7_Click(object sender, EventArgs e)

{

}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)

{

}

private void richTextBox3_TextChanged(object sender, EventArgs e)

{

}

private void label2_Click(object sender, EventArgs e)

{

}

private void richTextBox1_TextChanged(object sender, EventArgs e)

{

}

private void label1_Click(object sender, EventArgs e)

{

}

private void button7_Click(object sender, EventArgs e)

{

left();

left2();

}

#endregion

private void button3_Click(object sender, EventArgs e)

{

//for left block

label4.Visible = true;

textBox1.Visible = true;

label7.Visible = true;

listBox1.Visible = true;

richTextBox3.Visible = true;

label2.Visible = true;

richTextBox1.Visible = true;

label1.Visible = true;

button7.Visible = true;

button3.BackColor = Color.LightGray;

//for rigth block

button4.BackColor = Color.Gray;

label5.Visible = false;

textBox2.Visible = false;

label8.Visible = false;

listBox2.Visible = false;

label3.Visible = false;

richTextBox2.Visible = false;

button5.Visible = false;

button6.Visible = false;

label6.Visible = false;

richTextBox4.Visible = false;

}

private void button4_Click(object sender, EventArgs e)

{

//for rigth block

button4.BackColor = Color.LightGray;

label5.Visible = true;

textBox2.Visible = true;

label8.Visible = true;

listBox2.Visible = true;

label3.Visible = true;

richTextBox2.Visible = true;

button5.Visible = true;

button6.Visible = true;

label6.Visible = true;

richTextBox4.Visible = true;

//for left block

button3.BackColor = Color.Gray;

label4.Visible = false;

textBox1.Visible = false;

label7.Visible = false;

listBox1.Visible = false;

richTextBox3.Visible = false;

label2.Visible = false;

richTextBox1.Visible = false;

label1.Visible = false;

button7.Visible = false;

}

#region rigthblock

private void label5_Click(object sender, EventArgs e)

{

}

private void textBox2_TextChanged(object sender, EventArgs e)

{

}

private void label8_Click(object sender, EventArgs e)

{

}

private void listBox2_SelectedIndexChanged(object sender, EventArgs e)

{

}

private void label3_Click(object sender, EventArgs e)

{

}

private void richTextBox2_TextChanged(object sender, EventArgs e)

{

}

private void button5_Click(object sender, EventArgs e)

{

commandText = richTextBox4.Text;

Openfile();

}

//find

private void button6_Click(object sender, EventArgs e)

{

find();

}

private void label6_Click(object sender, EventArgs e)

{

}

private void richTextBox4_TextChanged(object sender, EventArgs e)

{

}

#endregion

private void Form2_Load(object sender, EventArgs e)

{

string t1 = "Real Madrid";

string t2 = "Manchester United";

string t3 = "Juventus";

string t4 = "PSG";

listBox1.Items.Add(t1);

listBox1.Items.Add(t2);

listBox1.Items.Add(t3);

listBox1.Items.Add(t4);

listBox2.Items.Add(t1);

listBox2.Items.Add(t2);

listBox2.Items.Add(t3);

listBox2.Items.Add(t4);

if (richTextBox4.Visible == true) { richTextBox4.Text = System.IO.File.ReadAllText("list.txt"); }

}

}

}

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]