private void AddFile(string file) { string shortFile = System.IO.Path.GetFileName(file); if (shortFile.Length > 35) { shortFile = shortFile.Substring(0, 33) + "..."; } Kennedy.FileWatcher.Controls.FileControl fileControl = null; Crownwood.Magic.Controls.TabPage pageControl = null; fileControl = new Kennedy.FileWatcher.Controls.FileControl(); pageControl = new Crownwood.Magic.Controls.TabPage(shortFile); pageControl.Controls.Add(fileControl); fileControl.Dock = DockStyle.Fill; fileControl.WordWrapContents = this.wordWrap; TabFilePair pair = new TabFilePair(pageControl, fileControl); tabPageList.Add(pair); tabControlMain.TabPages.Add(pageControl); fileControl.FileChanged += new Kennedy.FileWatcher.Controls.FileActionHandler(fileControl_FileChanged); fileControl.Initialize(file); tabControlMain.SelectedTab = pair.PageControl; activeFilesControl.AddFile(file); fileGroup.Add(file); }
private void ClosePage(Kennedy.FileWatcher.Controls.FileControl fileControl) { string lowerCaseFile = fileControl.Filename.ToLower(); foreach (TabFilePair pair in tabPageList) { if (pair.FileControl.Filename.ToLower() == lowerCaseFile) { ClosePage(pair); return; } } }