// Конструктор при создании нового списка public TableOfList(string login, Autorization autorization) { InitializeComponent(); startForm = autorization; username = login; creator = login; string path = "lastnumber.txt"; try { using (StreamReader sr = new StreamReader(path, Encoding.UTF8)) { string line; line = sr.ReadLine(); ID = line; } } catch { MessageBox.Show("Простите, в работе с базой списков что-то пошло не так"); } try { using (StreamWriter sw = new StreamWriter(path)) { sw.WriteLine(Int32.Parse(ID) + 1); } } catch { MessageBox.Show("Простите, в работе с базой списков что-то пошло не так"); } files.WriteInFile(username, ID); files.WriteInFile(ID, new List <List>(), false, username, "Неизвестно"); }
// Обработка передачи private void YesButton_Click(object sender, EventArgs e) { WorkWithFiles files = new WorkWithFiles(); if (textBox1.Text.Length > 0) { files.WriteInFile(textBox1.Text, ID); MessageBox.Show("У вас удалось поделиться"); } else { MessageBox.Show("Введите пользователя"); } }