/// <summary>
        /// 从数据库中为当前激活的选项卡装入信息
        /// </summary>
        /// <param name="argu"></param>
        private void LoadCurrentTabDataFromDB()
        {
            //绑定显示数据源
            if (findNodesWindow == null)
            {
                findNodesWindow = new FindNodes();
            }

            //创建连接字符串
            String EFConnectString = DALConfig.getEFConnectionString(curDbInfoTab.dbInfoObject.DatabaseFilePath);

            this.Title  = "个人资料管理中心-" + curDbInfoTab.dbInfoObject.DatabaseFilePath;
            this.Cursor = Cursors.AppStarting;
            //profiler发现,GetTreeFromDB()需要花费大量的时间,因此,将其移到独立的线程中去完成
            tbInfo.Text = "从数据库中装载数据……";
            Task tsk = new Task(() =>
            {
                curDbInfoTab.treeView1.EFConnectionString = EFConnectString;

                String treeXML = curDbInfoTab.treeView1.LoadTreeXMLFromDB();

                Action afterFetchTreeXML = () =>
                {
                    curDbInfoTab.treeView1.LoadFromXmlString(treeXML);
                    curDbInfoTab.treeView1.ShowNode(curDbInfoTab.dbInfoObject.LastVisitNodePath);
                    //绑定树节点集合到查找窗体
                    findNodesWindow.SetTree(curDbInfoTab.treeView1);
                    curDbInfoTab.visitedNodesManager = new VisitedNodesManager(curDbInfoTab.treeView1);

                    MenuItem mnuChangeTextColor = curDbInfoTab.treeView1.ContextMenu.Items[curDbInfoTab.treeView1.ContextMenu.Items.Count - 1] as MenuItem;

                    ColorBrushList brushList = new ColorBrushList(mnuChangeTextColor);
                    brushList.BrushChanged  += brushList_BrushChanged;
                    tbInfo.Text = "就绪。";
                    Cursor      = null;
                    //设置己从数据库中装入标记
                    curDbInfoTab.HasBeenLoadedFromDB = true;
                };
                Dispatcher.BeginInvoke(afterFetchTreeXML);
            });

            tsk.Start();
        }
        /// <summary>
        /// 从数据库中为当前激活的选项卡装入信息
        /// </summary>
        /// <param name="argu"></param>
        private void LoadCurrentTabDataFromDB()
        {
            //绑定显示数据源
            if (findNodesWindow == null)
            {
                findNodesWindow = new FindNodes();
            }

            //创建连接字符串
            String EFConnectString = DALConfig.getEFConnectionString(curDbInfoTab.dbInfoObject.DatabaseFilePath);

            this.Title = "个人资料管理中心-" + curDbInfoTab.dbInfoObject.DatabaseFilePath;
            this.Cursor = Cursors.AppStarting;
            //profiler发现,GetTreeFromDB()需要花费大量的时间,因此,将其移到独立的线程中去完成
            tbInfo.Text = "从数据库中装载数据……";
            Task tsk = new Task(() =>
            {
                curDbInfoTab.treeView1.EFConnectionString = EFConnectString;

                String treeXML = curDbInfoTab.treeView1.LoadTreeXMLFromDB();

                Action afterFetchTreeXML = () =>
                {

                    curDbInfoTab.treeView1.LoadFromXmlString(treeXML);
                    curDbInfoTab.treeView1.ShowNode(curDbInfoTab.dbInfoObject.LastVisitNodePath);
                    //绑定树节点集合到查找窗体
                    findNodesWindow.SetTree(curDbInfoTab.treeView1);
                    curDbInfoTab.visitedNodesManager = new VisitedNodesManager(curDbInfoTab.treeView1);

                    MenuItem mnuChangeTextColor = curDbInfoTab.treeView1.ContextMenu.Items[curDbInfoTab.treeView1.ContextMenu.Items.Count - 1] as MenuItem;

                    ColorBrushList brushList = new ColorBrushList(mnuChangeTextColor);
                    brushList.BrushChanged += brushList_BrushChanged;
                    tbInfo.Text = "就绪。";
                    Cursor = null;
                    //设置己从数据库中装入标记
                    curDbInfoTab.HasBeenLoadedFromDB = true;

                };
                Dispatcher.BeginInvoke(afterFetchTreeXML);
            });

            tsk.Start();
        }
        /// <summary>
        /// 完成系统初始化功能
        /// </summary>
        private void Init()
        {
            //设置NodeFactory的主窗体引用,以便让它创建节点对象时,一并将主窗体引用传给节点
            //从而允许节点调用主窗体的功能,此句代码必须在装入全树节点前完成,否则,节点的DataItem对象
            //将无法引用到主窗体
            NodeFactory._mainWindow = this;

            ConfigArgus argu = new ConfigArgus();
            tbVersionInfo.Text = String.Format("PersonalInfoForWPF ver: {0} 开发:金旭亮", ConfigArgus.version);
            //如果找到了配置文件
            if (File.Exists(SystemConfig.ConfigFileName))
            {
                tbInfo.Text = "正在加载配置文件……";
                //定位到上次访问的节点
                try
                {
                    argu = DeepSerializer.BinaryDeserialize(SystemConfig.ConfigFileName) as ConfigArgus;
                }
                catch (Exception)
                {
                    argu = null;
                }

                if (argu != null)
                {
                    SystemConfig.configArgus = argu;
                    //设置树节点的默认字体大小
                    TreeViewIconsItem.TreeNodeDefaultFontSize = argu.TreeNodeDefaultFontSize;
                }
                findNodesWindow = new FindNodes();
                //用于保存有效的数据库文件对象
                List<DatabaseInfo> validDBInfos = new List<DatabaseInfo>();
                //创建数据库选项卡
                foreach (var dbinfo in argu.DbInfos)
                {
                    if (File.Exists(dbinfo.DatabaseFilePath))
                    {
                        DBInfoTab tab = new DBInfoTab(dbinfo);
                        DBtabContainer.Add(System.IO.Path.GetFileName(dbinfo.DatabaseFilePath), tab);
                        validDBInfos.Add(dbinfo);
                    }

                }
                bool allDBAreOk = (argu.DbInfos.Count == validDBInfos.Count);
                if (!allDBAreOk)
                {
                    argu.DbInfos = validDBInfos;
                }

                if (DBtabContainer.Items.Count != 0)
                {
                    //设置当前激活的卡片

                    if (argu.ActiveDBIndex < DBtabContainer.Items.Count && allDBAreOk)
                    {
                        DBtabContainer.SelectedIndex = argu.ActiveDBIndex;
                    }
                    else
                    {
                        argu.ActiveDBIndex = 0;
                        DBtabContainer.SelectedIndex = 0;
                    }
                    curDbInfoTab = (DBtabContainer.Items[argu.ActiveDBIndex] as TabItem).Content as DBInfoTab;
                    LoadCurrentTabDataFromDB();
                }
                else
                {
                    tbInfo.Text = "未能找到上次打开的数据库,请从系统功能菜单中选择打开命令打开一个资料库";
                }
            }
            else
            {
                tbInfo.Text = "请从系统功能菜单中选择打开命令打开一个资料库";
            }

            //响应用户点击不同选项卡的操作
            DBtabContainer.SelectionChanged += DBtabContainer_SelectionChanged;
            //关闭选项卡时,激发此事件
            DBtabContainer.TabPageClosed += DBtabContainer_TabPageClosed;
        }
        /// <summary>
        /// 完成系统初始化功能
        /// </summary>
        private void Init()
        {
            //绑定显示数据源
            findNodesWindow = new FindNodes(treeView1);
            ConfigArgus argu = null;
            if (File.Exists(SystemConfig.ConfigFileName))
            {
                tbInfo.Text = "正在加载配置文件……";
                //定位到上次访问的节点
                try
                {
                    argu = DeepSerializer.BinaryDeserialize(SystemConfig.ConfigFileName) as ConfigArgus;
                }
                catch (Exception)
                {
                    argu = null;
                }

                if (argu != null)
                {
                    SystemConfig.configArgus = argu;
                    //设置树节点的默认字体大小
                    TreeViewIconsItem.TreeNodeDefaultFontSize = argu.TreeNodeDefaultFontSize;
                }

            }

            if (string.IsNullOrEmpty(SystemConfig.configArgus.DBFileName))
            {
                SystemConfig.configArgus.DBFileName = "infocenter.sdf";
            }
            //创建连接字符串
            DALConfig.ConnectString = DALConfig.getConnectionString(SystemConfig.configArgus.DBFileName);

            this.Title = "个人资料管理中心-" + SystemConfig.configArgus.DBFileName;
            this.Cursor = Cursors.AppStarting;
            //profiler发现,GetTreeFromDB()需要花费大量的时间,因此,将其移到独立的线程中去完成
            tbInfo.Text = "从数据库中装载数据……";
            Task tsk = new Task(() =>
            {
                String treeXML = MainTreeRepository.GetTreeFromDB();
                Action afterFetchTreeXML = () =>
                {
                    treeView1.LoadFromXmlString(treeXML);
                    if (argu != null)
                    {
                        treeView1.ShowNode(argu.LastVisitNodePath);
                    }

                    visitedNodesManager = new VisitedNodesManager(treeView1);

                    MenuItem mnuChangeTextColor = treeView1.ContextMenu.Items[treeView1.ContextMenu.Items.Count - 1] as MenuItem;

                    ColorBrushList brushList = new ColorBrushList(mnuChangeTextColor);
                    brushList.BrushChanged += brushList_BrushChanged;
                    tbInfo.Text = "就绪。";
                    Cursor = null;

                };
                Dispatcher.BeginInvoke(afterFetchTreeXML);
            });

            tsk.Start();
        }
        /// <summary>
        /// 完成系统初始化功能
        /// </summary>
        private void Init()
        {
            //设置NodeFactory的主窗体引用,以便让它创建节点对象时,一并将主窗体引用传给节点
            //从而允许节点调用主窗体的功能,此句代码必须在装入全树节点前完成,否则,节点的DataItem对象
            //将无法引用到主窗体
            NodeFactory._mainWindow = this;

            ConfigArgus argu = new ConfigArgus();

            tbVersionInfo.Text = String.Format("PersonalInfoForWPF ver: {0} 开发:金旭亮", ConfigArgus.version);
            //如果找到了配置文件
            if (File.Exists(SystemConfig.ConfigFileName))
            {
                tbInfo.Text = "正在加载配置文件……";
                //定位到上次访问的节点
                try
                {
                    argu = DeepSerializer.BinaryDeserialize(SystemConfig.ConfigFileName) as ConfigArgus;
                }
                catch (Exception)
                {
                    argu = null;
                }

                if (argu != null)
                {
                    SystemConfig.configArgus = argu;
                    //设置树节点的默认字体大小
                    TreeViewIconsItem.TreeNodeDefaultFontSize = argu.TreeNodeDefaultFontSize;
                }
                findNodesWindow = new FindNodes();
                //用于保存有效的数据库文件对象
                List <DatabaseInfo> validDBInfos = new List <DatabaseInfo>();
                //创建数据库选项卡
                foreach (var dbinfo in argu.DbInfos)
                {
                    if (File.Exists(dbinfo.DatabaseFilePath))
                    {
                        DBInfoTab tab = new DBInfoTab(dbinfo);
                        DBtabContainer.Add(System.IO.Path.GetFileName(dbinfo.DatabaseFilePath), tab);
                        validDBInfos.Add(dbinfo);
                    }
                }
                bool allDBAreOk = (argu.DbInfos.Count == validDBInfos.Count);
                if (!allDBAreOk)
                {
                    argu.DbInfos = validDBInfos;
                }

                if (DBtabContainer.Items.Count != 0)
                {
                    //设置当前激活的卡片

                    if (argu.ActiveDBIndex < DBtabContainer.Items.Count && allDBAreOk)
                    {
                        DBtabContainer.SelectedIndex = argu.ActiveDBIndex;
                    }
                    else
                    {
                        argu.ActiveDBIndex           = 0;
                        DBtabContainer.SelectedIndex = 0;
                    }
                    curDbInfoTab = (DBtabContainer.Items[argu.ActiveDBIndex] as TabItem).Content as DBInfoTab;
                    LoadCurrentTabDataFromDB();
                }
                else
                {
                    tbInfo.Text = "未能找到上次打开的数据库,请从系统功能菜单中选择打开命令打开一个资料库";
                }
            }
            else
            {
                tbInfo.Text = "请从系统功能菜单中选择打开命令打开一个资料库";
            }

            //响应用户点击不同选项卡的操作
            DBtabContainer.SelectionChanged += DBtabContainer_SelectionChanged;
            //关闭选项卡时,激发此事件
            DBtabContainer.TabPageClosed += DBtabContainer_TabPageClosed;
        }