/// <summary>
        /// ローテートログの追加
        /// </summary>
        void _NewLogFile()
        {
            var	lineDesign	= new TextDesign( null )
            {
                Typeface	= m_logTypeface,
                FontSize	= m_logFontSize,
                Foreground	= m_logForeground,
            };
            var	text	= "-------------------- ログファイルが再生成されました。以前のファイルの取得漏れの可能性があります。--------------------";
            lineDesign.Update( text );

            #if false
            var	item	= new LineListBoxItem2( lineLayout )
            {
                LineNum	= 0,
                FontFamily	= m_logFontFamily,
                FontStyle	= m_logFontStyle,
                FontWeight	= m_logFontWeight,
                FontStretch	= m_logFontStretch,
                FontSize	= m_logFontSize,
                Foreground	= m_logForeground,
            };
            #else
            var	item	= new LineListBoxItem( lineDesign )
            {
                LineNum		= 0,
                FontFamily	= m_logFontFamily,
                FontSize	= m_logFontSize,
            };
            #endif
            m_data.Add( item );
        }
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="tailer"></param>
        public LogTailerWindow( Tailer tailer, FontFamily fontFamily, double fontSize )
        {
            InitializeComponent();

            Tailer	= tailer;

            // タイトルバー
            Title	= string.Format( "LogTailer - {0}",tailer.Name );

            // シャッターの設定
            {
                // タイトル
                m_title.Text	= tailer.Name;

                // バージョン番号
                var cetExecutingAssembly	= System.Reflection.Assembly.GetExecutingAssembly();
                var	varsion	= cetExecutingAssembly.GetName().Version;
                m_version.Text	= string.Format( "ver {0}.{1}", varsion.Major, varsion.Minor );
            }

            // コピーコマンド
            this.CommandBindings.Add( new CommandBinding( ApplicationCommands.Copy, _CopyExecuted, _CanCopyExecute ) );

            // LogListBox の設定
            {
            //				ScrollViewer.SetIsDeferredScrollingEnabled( m_listbox, true );		// スクロール中は描画を更新しない
            //				ScrollViewer.SetCanContentScroll( m_listbox, false );				// 仮想化OFF
            //				VirtualizingPanel.SetScrollUnit( m_logListBox, ScrollUnit.Pixel );	// ピクセル単位のスクロール or 行単位のスクロール
            }

            // Data と ListBox をバインド
            {
                var	binding	= new Binding()
                {
                    Mode		= BindingMode.OneWay,
                    Source		= m_viewSource,
                };
                m_viewSource.Source		= m_data;
                m_viewSource.Filter		+= m_viewSource_Filter;
                m_logListBox.SetBinding( ListBox.DataContextProperty, binding );
            }

            // ログファイルリーダー
            m_logReader	= new LogFileReader()
            {
                FilePath	= Tailer.FilePath,
                Encoding	= Tailer.Encoding,
            };

            // ログファイルの監視
            m_logWatcher	= new LogFileSystemWatcher()
            {
                FilePath		= Tailer.FilePath,
                UpdatePeriod	= Tailer.UpdatePeriod,
            };
            m_logWatcher.LogFileChanged += _logWatcher_LogFileChanged;
            //			m_logWatcher.Start();		// 表示状態の変更により開始される

            m_filterTextBox.FilterChanged += m_filterTextBox_FilterChanged;

            // ログテキストブロックのフォント設定を保存する
            {
                var	dummy			= new LineListBoxItem( null );
                m_logFontFamily		= fontFamily;
                m_logTypeface		= new Typeface( fontFamily, dummy.FontStyle, dummy.FontWeight, dummy.FontStretch );
                m_logFontSize		= fontSize;
                m_logForeground		= dummy.Foreground;
            }

            // ハイパーリンクの設定
            if( string.IsNullOrEmpty( tailer.LinkName ) ||
                string.IsNullOrEmpty( tailer.LinkUri ) )
            {
                m_linkTextBlock.Visibility	= Visibility.Hidden;
            }
            else
            {
                var	hyperlink	= new Hyperlink()
                {
                    NavigateUri	= new Uri( tailer.LinkUri ),
                };
                hyperlink.Inlines.Add( new Run( tailer.LinkName ) );
                hyperlink.Click += hyperlink_Click;

                m_linkTextBlock.Inlines.Clear();
                m_linkTextBlock.Inlines.Add( hyperlink );
            }
        }
        /// <summary>
        /// 行テキストブロックの追加
        /// </summary>
        /// <param name="readData"></param>
        /// <param name="lineDesigns"></param>
        void _AddLineListBoxItem( ReadData readData, List<TextDesign> lineDesigns )
        {
            // ログのローテートの可能性
            {
                if( readData.EndPosition < m_lastPosition )
                {
                    _NewLogFile();
                }
                m_lastPosition	= readData.EndPosition;
            }

            var	startIndex	= 0;
            var	lineNum	= readData.StartLineNum;
            {
                var	maxLine	= Tailer.MaxLine;
                if( m_first )
                {
                    // 一度に大量のログを追加すると固まってしまうので、初回は数行のみ
                    maxLine	= m_firstMaxLine;
                }

                if( readData.Lines.Count > maxLine )
                {
                    startIndex	= readData.Lines.Count - maxLine;
                    lineNum		+= startIndex;
                }
            }

            // 初回時のみアニメーションしない
            var	animation	= !m_first;

            // LineListBoxItem の作成
            var	active	= false;
            foreach( var textLayout in lineDesigns )
            {
            #if true
                var	item	= new LineListBoxItem( textLayout )
                {
                    LineNum		= lineNum ++,
                    FontFamily	= m_logFontFamily,
                    FontSize	= m_logFontSize,
                };

                // フェードインアニメーション
                if( animation )
                {
                    item.FadeinAnimation();
                }
                if( item.IsActiveLine )
                {
                    active	= true;
                }
                m_data.Add( item );
            #else
                var	item	= new LineListBoxItem( textLayout )
                {
                    LineNum	= lineNum ++,
                    FontFamily	= m_logFontFamily,
                    FontStyle	= m_logFontStyle,
                    FontWeight	= m_logFontWeight,
                    FontStretch	= m_logFontStretch,
                    FontSize	= m_logFontSize,
                    Foreground	= m_logForeground,
                };
                // フェードインアニメーション
                if( animation )
                {
                    item.FadeinAnimation();
                }
                if( item.IsActiveLine )
                {
                    active	= true;
                }

                m_data.Add( item );
            #endif
            }

            // 最大行数を超えた分は削除する
            _DeleteLine();

            // スクロール
            _ScrollIntoViewLastItem();

            // アクティブ
            if( m_first == false && active )
            {
                _Active();
            }

            m_first	= false;
        }