private void newToolStripButton_Click(object sender, EventArgs e) { if (NumberPages < 20) { WordCountint = 0; WordCountText.Text = WordCountint.ToString(); Source = "Entery.txt"; if (NumberPages != 0) { AddPage("NewPage" + NumberPages, ""); } else if (NumberPages == 0) { AddPage("NewPage", ""); } if (NumberPages > 0) { FileTabs.SelectTab(NumberPages - 1); } Debug.WriteLine("Added new page "); } }
public void AddPage(string FileName, string _text) { TabPage tb = new TabPage(FileName); tb.BackColor = Color.White; RichTextBox RTB = new RichTextBox(); RTB.Click += JournalText_Click; RTB.BorderStyle = BorderStyle.None; string name = "New Page"; RTB.ScrollBars = RichTextBoxScrollBars.Vertical; RTB.Multiline = true; RTB.Dock = DockStyle.Fill; RTB.WordWrap = false; tb.Controls.Add(RTB); RTB.ContextMenuStrip = contextMenuStrip1; name += NumberPages.ToString(); RTB.Name = name; FontFamily family = new FontFamily("Times New Roman"); Font new_font = new Font(family, fontsize); RTB.Font = new_font; RTB.Rtf = _text; FileTabs.TabPages.Add(tb); Datavar = new DataVariable(); Datavar.Tabs = RTB; Datavar.Encrypted = false; NumberPages++; Datavar.FileSources = Source; DataVarList.Add(Datavar); FileTabs.SelectTab(NumberPages - 1); CalcWordCount(); FontText.Text = fontsize.ToString(); //UnRedo.AddPage(); Debug.WriteLine("Added new page " + FileName); }
private void AddFiles(string fileName) { try { FileInfo FI = new FileInfo(fileName); FileData FD = new FileData(FI.FullName); if (FD.GetFileType() == "Audio") { for (int i = 0; i < AudioListBox.Items.Count; i++) { if (FD == (FileData)AudioListBox.Items[i]) { AudioListBox.Items.RemoveAt(i); i--; } } AudioListBox.Items.Add(FD); FileTabs.SelectTab(AudioPage); check = true; CreateXML("Audio"); } else if (FD.GetFileType() == "Video") { for (int i = 0; i < VideoListBox.Items.Count; i++) { if (FD == (FileData)VideoListBox.Items[i]) { VideoListBox.Items.RemoveAt(i); i--; } } VideoListBox.Items.Add(FD); FileTabs.SelectTab(VideoPage); check = true; CreateXML("Video"); } else if (FD.GetFileType() == "Image") { for (int i = 0; i < PictureListBox.Items.Count; i++) { if (FD == (FileData)PictureListBox.Items[i]) { PictureListBox.Items.RemoveAt(i); i--; } } PictureListBox.Items.Add(FD); FileTabs.SelectTab(PicturePage); check = true; CreateXML("Image"); } else if (FD.GetFileType() == "Invalid") { MessageBox.Show("Invalid File: " + fileName, "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception) { } }