private void toolStripMenuItem1_Click(object sender, EventArgs e) //переименовывание СФа { string nameSF; int i = listBox1.SelectedIndex; nameSF = Interaction.InputBox("Хотите дать название смысловому фрагменту? Введите название и нажмите ОК.", "", Convert.ToString(listBox1.Items[i])); if (nameSF == "") { nameSF = Convert.ToString(listBox1.Items[i]); } string A = comboBox1.Text; //хотелось бы убрать по возможности //A = "Иван"; // Потом убрать, это времянка!!!! string p1 = ""; if (label1.Text == "1") { Sergey.Serg(out p1); } else if (label1.Text == "0") { Sergey.Ukr(out p1); } Vlad.pereimSF(listBox1, p1 + "/The table of semantic fragments/" + A + ".txt", nameSF); Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(p1 + "/Text documents/" + A + ".txt", p1 + "/The table of semantic fragments/" + A + ".txt", textBox1); // потом добавить 0 в конец из-за изменений вани. Надо доработать координату фокуса при переименовывании Vlad.b1(listBox1, p1 + "/The table of semantic fragments/" + A + ".txt"); Vlad.focusirovka(i, textBox1, Intron); }
public static int[,] ComboBox2_SelectedIndexChanged(System.Windows.Forms.ComboBox comboBox2, System.Windows.Forms.TextBox textBox, System.Windows.Forms.ListBox listBox, int[,] Intron, System.Windows.Forms.Label Label) { if (Label.Text == "1") { for (int i = 0; i < S_nameFile.Count; i++) { if (comboBox2.Text == S_nameFile[i]) { textBox.Text = S_textFile[i]; Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(S_Dobavl + "/Text documents/" + S_nameFile[i] + ".txt", S_Dobavl + "/The table of semantic fragments/" + S_nameFile[i] + ".txt", textBox); // <- Здесь был Ваня Vlad.b3(textBox, Intron); Vlad.b1(listBox, S_Dobavl + "/The table of semantic fragments/" + S_nameFile[i] + ".txt"); } } } else if (Label.Text == "0") { for (int i = 0; i < S_nameFile.Count; i++) { if (comboBox2.Text == S_nameFile[i]) { textBox.Text = S_textFile[i]; Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(S_Osnova + "/Text documents/" + S_nameFile[i] + ".txt", S_Osnova + "/The table of semantic fragments/" + S_nameFile[i] + ".txt", textBox); // <- Здесь был Ваня Vlad.b3(textBox, Intron); Vlad.b1(listBox, S_Osnova + "/The table of semantic fragments/" + S_nameFile[i] + ".txt"); } } } return(Intron); }
static void Main(string[] args) { Vlad moi = new Vlad(); string str = moi; Console.WriteLine(str); Console.ReadLine(); }
private void button1_Click(object sender, EventArgs e) { string A = comboBox1.Text; string p1 = ""; //A = "Иван"; // Потом убрать, это времянка!!!! if (label1.Text == "1") { Sergey.Serg(out p1); } else if (label1.Text == "0") { Sergey.Ukr(out p1); } //p1 = "E://Иван/Рабочий стол/Primer"; if (IvanLibrary.CreateSemanticFile.SelectedTextIntoIndexForSemanticFragmentTable(textBox1, p1 + "/The table of semantic fragments/" + A + ".txt", Intron)) { Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(p1 + "/Text documents/" + A + ".txt", p1 + "/The table of semantic fragments/" + A + ".txt", textBox1); Vlad.focusirovka(IvanLibrary.FocusAfterCreateSemanticFile.FindNewElementofSFT(p1 + "/The table of semantic fragments/" + A + ".txt"), textBox1, Intron); } Vlad.b1(listBox1, p1 + "/The table of semantic fragments/" + A + ".txt"); }
private void удалитьToolStripMenuItem_Click(object sender, EventArgs e) //удаление СФа { string A = comboBox1.Text; //хотелось бы убрать по возможности // A = "Иван"; // Потом убрать, это времянка!!!! string p1 = ""; if (label1.Text == "1") { Sergey.Serg(out p1); } else if (label1.Text == "0") { Sergey.Ukr(out p1); } int i = listBox1.SelectedIndex; i = Intron[i * 2, 1] - (Intron[i * 2, 1] - Intron[i * 2, 0]) + 1; Vlad.delSF(listBox1, p1 + "/The table of semantic fragments/" + A + ".txt"); Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(p1 + "/Text documents/" + A + ".txt", p1 + "/The table of semantic fragments/" + A + ".txt", textBox1); // потом добавить 0 в конец из-за изменений вани. Надо доработать координату фокуса при удалении Vlad.b1(listBox1, p1 + "/The table of semantic fragments/" + A + ".txt"); textBox1.Select(i, 0); textBox1.ScrollToCaret(); }
private void textBox1_TextChanged(object sender, EventArgs e) { Vlad.tb1change(textBox1); }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { Vlad.lb1(listBox1, textBox1, Intron); }
public static int[,] добавитьФайлToolStripMenuItem_Click(System.Windows.Forms.TextBox textBox, System.Windows.Forms.ComboBox comboBox, System.Windows.Forms.ListBox listBox, System.Windows.Forms.OpenFileDialog openFileDialog1, int[,] Intron, System.Windows.Forms.Label Label) { if (Label.Text == "0") //на открытие { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog1.Filter = "text files(*.doc; *.docx)| *.doc; *.docx"; if (openFileDialog1.ShowDialog() == DialogResult.OK) //Открытие диалогового окна для открытия файла { S_namefiledirect = openFileDialog1.FileName; //Сохранение в переменную пути к выбранному фалу S_namefile = openFileDialog1.SafeFileName; //Сохранение в переменную имени выбранного файла S_namefile = S_namefile.Remove(S_namefile.IndexOf(".docx")); S_wordapp = new Word.Application(); //Создаем объект Word - равносильно запуску Word. S_wordapp.Visible = false; Object filename = S_namefiledirect; S_worddocument = S_wordapp.Documents.Open(ref filename); //Открываем конкретный существующий word документ из нужной директории. Object begin = Type.Missing; //В документе определяем диапазон,вызовом метода Range Object end = Type.Missing; //с передачей ему начального Word.Range wordrange = S_worddocument.Range(ref begin, ref end); //и конечного значений позиций символов. wordrange.Copy(); //Копирование в буфер обмена. S_text = Clipboard.GetText(); //Сохранение в переменную скопированного текста if (S_Osnova != S_STD) { System.IO.File.WriteAllText((S_STD + "/" + S_namefile + ".txt"), S_text); //Создание текстового файла txt и запись в него текста из буфера обмена System.IO.File.WriteAllText((S_Osnova + "/" + "The table of semantic fragments" + "/" + S_namefile + ".txt"), ""); //Создание текстового файла для таблиц смысловых фрагментов comboBox.Items.Add(S_namefile); //Добавление в combobox1 имени файла, с которого мы скопировали текст comboBox.Text = S_namefile; //Надпись комбобокса меняется на имя файла listBox.Items.Clear(); //очистка листбкса S_nameFile.Add(S_namefile); //Добавление в список имени файла S_textFile.Add(S_text); //Добавление в список текста файла Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(S_Osnova + "/Text documents/" + S_namefile + ".txt", S_Osnova + "/The table of semantic fragments/" + S_namefile + ".txt", textBox); // <- Здесь был Ваня Vlad.b1(listBox, S_Osnova + "/The table of semantic fragments/" + S_namefile + ".txt"); Object saveChanges = Word.WdSaveOptions.wdPromptToSaveChanges; Object originalFormat = Word.WdOriginalFormat.wdWordDocument; Object routeDocument = Type.Missing; S_wordapp.Quit(ref saveChanges, ref originalFormat, ref routeDocument); // Закрытие файла S_wordapp = null; } if (S_Osnova == S_STD) { System.IO.File.WriteAllText((S_STD + "/" + S_namefile + ".txt"), S_text); //Создание текстового файла txt и запись в него текста из буфера обмена System.IO.File.WriteAllText((S_Dobavl + "/" + "The table of semantic fragments" + "/" + S_namefile + ".txt"), ""); //Создание текстового файла для таблиц смысловых фрагментов comboBox.Items.Add(S_namefile); //Добавление в combobox1 имени файла, с которого мы скопировали текст comboBox.Text = S_namefile; //Надпись комбобокса меняется на имя файла listBox.Items.Clear(); //очистка листбкса S_nameFile.Add(S_namefile); //Добавление в список имени файла S_textFile.Add(S_text); //Добавление в список текста файла Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(S_Dobavl + "/Text documents/" + S_namefile + ".txt", S_Dobavl + "/The table of semantic fragments/" + S_namefile + ".txt", textBox); // <- Здесь был Ваня Vlad.b1(listBox, S_Dobavl + "/The table of semantic fragments/" + S_namefile + ".txt"); Object saveChanges = Word.WdSaveOptions.wdPromptToSaveChanges; Object originalFormat = Word.WdOriginalFormat.wdWordDocument; Object routeDocument = Type.Missing; S_wordapp.Quit(ref saveChanges, ref originalFormat, ref routeDocument); // Закрытие файла S_wordapp = null; } } } else if (Label.Text == "1") //на создание { OpenFileDialog openFileDialog2 = new OpenFileDialog(); openFileDialog1.Filter = "text files(*.doc; *.docx)| *.doc; *.docx"; if (openFileDialog1.ShowDialog() == DialogResult.OK) //Открытие диалогового окна для открытия файла { S_namefiledirect = openFileDialog1.FileName; //Сохранение в переменную пути к выбранному фалу S_namefile = openFileDialog1.SafeFileName; //Сохранение в переменную имени выбранного файла S_namefile = S_namefile.Remove(S_namefile.IndexOf(".docx")); S_wordapp = new Word.Application(); //Создаем объект Word - равносильно запуску Word. S_wordapp.Visible = false; Object filename = S_namefiledirect; S_worddocument = S_wordapp.Documents.Open(ref filename); //Открываем конкретный существующий word документ из нужной директории. Object begin = Type.Missing; //В документе определяем диапазон,вызовом метода Range Object end = Type.Missing; //с передачей ему начального Word.Range wordrange = S_worddocument.Range(ref begin, ref end); //и конечного значений позиций символов. wordrange.Copy(); //Копирование в буфер обмена. S_text = Clipboard.GetText(); //Сохранение в переменную скопированного текста if (S_Osnova != S_STD) { System.IO.File.WriteAllText((S_STD + "/" + S_namefile + ".txt"), S_text); //Создание текстового файла txt и запись в него текста из буфера обмена System.IO.File.WriteAllText((S_Osnova + "/" + "The table of semantic fragments" + "/" + S_namefile + ".txt"), ""); //Создание текстового файла для таблиц смысловых фрагментов comboBox.Items.Add(S_namefile); //Добавление в combobox1 имени файла, с которого мы скопировали текст comboBox.Text = S_namefile; //Надпись комбобокса меняется на имя файла listBox.Items.Clear(); //очистка листбкса S_nameFile.Add(S_namefile); //Добавление в список имени файла S_textFile.Add(S_text); //Добавление в список текста файла Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(S_Osnova + "/Text documents/" + S_namefile + ".txt", S_Osnova + "/The table of semantic fragments/" + S_namefile + ".txt", textBox); // <- Здесь был Ваня Vlad.b1(listBox, S_Osnova + "/The table of semantic fragments/" + S_namefile + ".txt"); Object saveChanges = Word.WdSaveOptions.wdPromptToSaveChanges; Object originalFormat = Word.WdOriginalFormat.wdWordDocument; Object routeDocument = Type.Missing; S_wordapp.Quit(ref saveChanges, ref originalFormat, ref routeDocument); // Закрытие файла S_wordapp = null; } if (S_Osnova == S_STD) { System.IO.File.WriteAllText((S_STD + "/" + S_namefile + ".txt"), S_text); //Создание текстового файла txt и запись в него текста из буфера обмена System.IO.File.WriteAllText((S_Dobavl + "/" + "The table of semantic fragments" + "/" + S_namefile + ".txt"), ""); //Создание текстового файла для таблиц смысловых фрагментов comboBox.Items.Add(S_namefile); //Добавление в combobox1 имени файла, с которого мы скопировали текст comboBox.Text = S_namefile; //Надпись комбобокса меняется на имя файла listBox.Items.Clear(); //очистка листбкса S_nameFile.Add(S_namefile); //Добавление в список имени файла S_textFile.Add(S_text); //Добавление в список текста файла Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(S_Dobavl + "/Text documents/" + S_namefile + ".txt", S_Dobavl + "/The table of semantic fragments/" + S_namefile + ".txt", textBox); // <- Здесь был Ваня Vlad.b1(listBox, S_Dobavl + "/The table of semantic fragments/" + S_namefile + ".txt"); Object saveChanges = Word.WdSaveOptions.wdPromptToSaveChanges; Object originalFormat = Word.WdOriginalFormat.wdWordDocument; Object routeDocument = Type.Missing; S_wordapp.Quit(ref saveChanges, ref originalFormat, ref routeDocument); // Закрытие файла S_wordapp = null; } } } return(Intron); }
public static int[,] удалитьФайлToolStripMenuItem_Click(System.Windows.Forms.ComboBox comboBox, System.Windows.Forms.TextBox textBox, System.Windows.Forms.ListBox listBox, int[,] Intron, System.Windows.Forms.Label Label, System.Windows.Forms.ComboBox comboBox2) { if (Label.Text == "0") //на открытие) { if (MessageBox.Show("Удалить текущий документы?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { for (int i = 0; i < S_nameFile.Count; i++) { if (comboBox.Text == S_nameFile[i]) { comboBox.Items.Remove(S_nameFile[i]); comboBox2.Items.Remove(S_nameFile[i]); S_Perem1 = S_nameFile[i]; S_nameFile.RemoveAt(i); S_textFile.RemoveAt(i); if (i == 0 && S_nameFile.Count != 0) { comboBox.Text = S_nameFile[i]; comboBox2.Text = S_nameFile[i]; textBox.Text = S_textFile[i]; Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(S_Osnova + "/Text documents/" + S_nameFile[i] + ".txt", S_Osnova + "/The table of semantic fragments/" + S_nameFile[i] + ".txt", textBox); // <- Здесь был Ваня Vlad.b1(listBox, S_Osnova + "/The table of semantic fragments/" + S_nameFile[i] + ".txt"); //вставка FileInfo fileInf = new FileInfo(S_STD + "/" + S_Perem1 + ".txt"); if (fileInf.Exists) { fileInf.Delete(); } if (S_Osnova == S_STD) //удаление таблици смысловых фрагментов у вновь созданного проекта { FileInfo file = new FileInfo(S_Dobavl + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } if (S_Osnova != S_STD) //удаление таблици смысловых фрагментов у существующего открытого { FileInfo file = new FileInfo(S_Osnova + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } } if (i != 0 && S_nameFile.Count != 0) { comboBox.Text = S_nameFile[i - 1]; comboBox2.Text = S_nameFile[i - 1]; textBox.Text = S_textFile[i - 1]; Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(S_Osnova + "/Text documents/" + S_nameFile[i - 1] + ".txt", S_Osnova + "/The table of semantic fragments/" + S_nameFile[i - 1] + ".txt", textBox); // <- Здесь был Ваня Vlad.b1(listBox, S_Osnova + "/The table of semantic fragments/" + S_nameFile[i - 1] + ".txt"); //вставка FileInfo fileInf = new FileInfo(S_STD + "/" + S_Perem1 + ".txt"); if (fileInf.Exists) { fileInf.Delete(); } if (S_Osnova == S_STD) //удаление таблици смысловых фрагментов у вновь созданного проекта { FileInfo file = new FileInfo(S_Dobavl + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } if (S_Osnova != S_STD) //удаление таблици смысловых фрагментов у существующего открытого { FileInfo file = new FileInfo(S_Osnova + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } } if (i == 0 && S_nameFile.Count == 0) { comboBox.Items.Clear(); comboBox.Text = ""; comboBox2.Items.Clear(); comboBox2.Text = ""; S_nameFile.Clear(); S_textFile.Clear(); textBox.Text = ""; FileInfo fileInf = new FileInfo(S_STD + "/" + S_Perem1 + ".txt"); if (fileInf.Exists) { fileInf.Delete(); } if (S_Osnova == S_STD) //удаление таблици смысловых фрагментов у вновь созданного проекта { FileInfo file = new FileInfo(S_Dobavl + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } if (S_Osnova != S_STD) //удаление таблици смысловых фрагментов у существующего открытого проекта { FileInfo file = new FileInfo(S_Osnova + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } } } } } } else if (Label.Text == "1") { if (MessageBox.Show("Удалить текущий документы?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { for (int i = 0; i < S_nameFile.Count; i++) { if (comboBox.Text == S_nameFile[i]) { comboBox.Items.Remove(S_nameFile[i]); comboBox2.Items.Remove(S_nameFile[i]); S_Perem1 = S_nameFile[i]; S_nameFile.RemoveAt(i); S_textFile.RemoveAt(i); if (i == 0 && S_nameFile.Count != 0) { comboBox.Text = S_nameFile[i]; comboBox2.Text = S_nameFile[i]; textBox.Text = S_textFile[i]; // Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(S_Dobavl + "/Text documents/" + S_nameFile[i] + ".txt", S_Dobavl + "/The table of semantic fragments/" + S_nameFile[i] + ".txt", textBox); //вставка Vlad.b1(listBox, S_Dobavl + "/The table of semantic fragments/" + S_nameFile[i] + ".txt"); //вставка textBox.Text = S_textFile[i]; Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(S_Dobavl + "/Text documents/" + S_nameFile[i] + ".txt", S_Dobavl + "/The table of semantic fragments/" + S_nameFile[i] + ".txt", textBox); // <- Здесь был Ваня Vlad.b1(listBox, S_Dobavl + "/The table of semantic fragments/" + S_nameFile[i] + ".txt"); //вставка FileInfo fileInf = new FileInfo(S_STD + "/" + S_Perem1 + ".txt"); if (fileInf.Exists) { fileInf.Delete(); } if (S_Osnova == S_STD) //удаление таблици смысловых фрагментов у вновь созданного проекта { FileInfo file = new FileInfo(S_Dobavl + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } if (S_Osnova != S_STD) //удаление таблици смысловых фрагментов у существующего открытого { FileInfo file = new FileInfo(S_Osnova + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } } if (i != 0 && S_nameFile.Count != 0) { comboBox.Text = S_nameFile[i - 1]; comboBox2.Text = S_nameFile[i - 1]; textBox.Text = S_textFile[i - 1]; Intron = IvanLibrary.GiveMeBlockStructureWithRemainElements.StartWorking(S_Dobavl + "/Text documents/" + S_nameFile[i - 1] + ".txt", S_Dobavl + "/The table of semantic fragments/" + S_nameFile[i - 1] + ".txt", textBox); // <- Здесь был Ваня Vlad.b1(listBox, S_Dobavl + "/The table of semantic fragments/" + S_nameFile[i - 1] + ".txt"); //вставка FileInfo fileInf = new FileInfo(S_STD + "/" + S_Perem1 + ".txt"); if (fileInf.Exists) { fileInf.Delete(); } if (S_Osnova == S_STD) //удаление таблици смысловых фрагментов у вновь созданного проекта { FileInfo file = new FileInfo(S_Dobavl + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } if (S_Osnova != S_STD) //удаление таблици смысловых фрагментов у существующего открытого { FileInfo file = new FileInfo(S_Osnova + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } } if (i == 0 && S_nameFile.Count == 0) { comboBox.Items.Clear(); comboBox.Text = ""; comboBox2.Items.Clear(); comboBox2.Text = ""; S_nameFile.Clear(); S_textFile.Clear(); textBox.Text = ""; FileInfo fileInf = new FileInfo(S_STD + "/" + S_Perem1 + ".txt"); if (fileInf.Exists) { fileInf.Delete(); } if (S_Osnova == S_STD) //удаление таблици смысловых фрагментов у вновь созданного проекта { FileInfo file = new FileInfo(S_Dobavl + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } if (S_Osnova != S_STD) //удаление таблици смысловых фрагментов у существующего открытого проекта { FileInfo file = new FileInfo(S_Osnova + "/" + "The table of semantic fragments" + "/" + S_Perem1 + ".txt"); if (file.Exists) { file.Delete(); } } } } } } } return(Intron); }