예제 #1
0
        private void FileNamesCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (UserSettings.Application.RememberOpenFiles)
            {
                SystemSettings.OpenFiles = FileNames;
            }

            if (FileNames == null)
            {
                SelectedTab = null;
                return;
            }

            if (e.Action != NotifyCollectionChangedAction.Add)
            {
                return;
            }

            using (new CursorManager())
            {
                foreach (var fileName in FileNames)
                {
                    if (!TabFileItems.Any(tab => tab.FileName == fileName))
                    {
                        LoadFile(fileName);
                    }
                }
            }
        }
예제 #2
0
        public void Close(TabFileItem tabItem)
        {
            int index = TabFileItems.IndexOf(tabItem);

            FileNames.Remove(tabItem.FileName);
            TabFileItems.Remove(tabItem);
            tabItem.TailService.Dispose();

            if (TabFileItems.Count == 0)
            {
                Buffer.Clear();
            }

            SelectedTab = TabFileItems.Any() ? TabFileItems[Math.Min(index, TabFileItems.Count - 1)] : null;
        }