private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (findNodesWindow != null)
            {
                findNodesWindow.ShouldExit = true;
                findNodesWindow.Close();
            }

            //用户没有打开任何数据库文件
            if (curDbInfoTab == null)
            {
                return;
            }
            if (curDbInfoTab.treeView1.IsInEditMode)
            {
                curDbInfoTab.treeView1.SelectedItem.EndEdit();
            }
            SaveDbTabDataToDB(curDbInfoTab);


            //更新配置文件内容
            DatabaseInfo      info         = null;
            TreeViewIconsItem selectedItem = null;

            SystemConfig.configArgus.DbInfos.Clear();
            foreach (var item in DBtabContainer.Items)
            {
                selectedItem = ((item as TabItem).Content as DBInfoTab).treeView1.SelectedItem;
                info         = ((item as TabItem).Content as DBInfoTab).dbInfoObject;

                SystemConfig.configArgus.DbInfos.Add(info);
            }
            SystemConfig.configArgus.ActiveDBIndex = DBtabContainer.SelectedIndex;
            DeepSerializer.BinarySerialize(SystemConfig.configArgus, SystemConfig.ConfigFileName);
        }
示例#2
0
        private void ShowConfigWin(object sender, ExecutedRoutedEventArgs e)
        {
            ConfigWin win    = new ConfigWin();
            bool?     result = win.ShowDialog();

            if (curDbInfoTab.CurrentTreeView.IsInEditMode)
            {
                curDbInfoTab.CurrentTreeView.SelectedItem.EndEdit();
            }
            if (result.Value && SystemConfig.configArgus.IsArgumentsValueChanged)
            {
                DeepSerializer.BinarySerialize(SystemConfig.configArgus, SystemConfig.ConfigFileName);

                MessageBox.Show("参数修改,请重新启动程序", "重启");

                findNodesWindow.ShouldExit = true;
                Close();
                Process.Start(Assembly.GetEntryAssembly().Location);
            }
        }