//============================================================ // <T>加载配置信息。</T> // // @param xconfig 配置信息 //============================================================ public void LoadOrignConfig(FXmlNode xconfig) { _displays.Clear(); // 读取节点集合 foreach (FXmlNode xnode in xconfig.Nodes) { if (xnode.IsName("Matrix")) { // 读取矩阵 _modelMatrix.LoadSingleConfig(xnode); } else if (xnode.IsName("Display")) { // 读取显示信息 FDrSceneDisplay display = new FDrSceneDisplay(); display.Parent = this; display.Scene = _scene; display.LoadOrignConfig(xnode); _displays.Push(display); } } // 计算显示集合 foreach (FDrSceneDisplay display in _displays) { display.UpdateMatrix(); } }
//============================================================ // <T>加载配置信息。</T> // // @param xconfig 配置信息 //============================================================ public void LoadOrignConfig(FXmlNode xconfig) { _nodes.Clear(); _displays.Clear(); // 读取所有信息 foreach (FXmlNode xnode in xconfig.Nodes) { if (xnode.IsName("Node")) { FDrSceneNode sceneNode = new FDrSceneNode(); sceneNode.Parent = this; sceneNode.Scene = _scene; sceneNode.LoadOrignConfig(xnode); _nodes.Push(sceneNode); } } // 获得所有显示对象 foreach (FDrSceneNode node in _nodes) { node.FilterDisplays(_displays); } foreach (FDrSceneDisplay display in _displays) { display.UpdateMatrix(); } }
//============================================================ // <T>加载全部处理。</T> //============================================================ public virtual void LoadAll() { // 清空集合 if (_folders != null) { _folders.Clear(); } if (_objects != null) { _objects.Clear(); } // 加载所有子目录 foreach (string path in RDirectory.ListDirectories(_directory)) { // 跳过SVN目录 if (path.IndexOf(".svn") != -1) { continue; } // 加载子目录 OnLoadFolder(path); } if (_folders != null) { _folders.Sort(); } // 加载配置 if (RFile.Exists(ConfigFileName)) { FXmlDocument xdoc = new FXmlDocument(); xdoc.LoadFile(ConfigFileName); LoadConfig(xdoc.Root); } }
//============================================================ // <T>刷新器。</T> //============================================================ private void timRefresh_Tick(object sender, System.EventArgs e) { FObjects <FTrack> tracks = RMoCore.TrackConsole.Tracks; FTrack[] trackItems = null; lock (tracks) { trackItems = tracks.ToArray(); tracks.Clear(); } if (trackItems.Length > 0) { lvwTracks.BeginUpdate(); foreach (FTrack track in trackItems) { if (null != track) { ListViewItem lviTrack = new ListViewItem(); lviTrack.Text = track.Datetime.ToString(); lviTrack.SubItems.Add(track.Sender); lviTrack.SubItems.Add(track.Message); lvwTracks.Items.Add(lviTrack); } } lvwTracks.EndUpdate(); Show(); BringToFront(); } }
//============================================================ public void Clear() { foreach (IControl control in _controls) { control.Dispose(); } _controls.Clear(); }
//============================================================ // <T>反序列化数据信息。</T> // // @param input 输入流 //============================================================ public void Unserialize(IInput input) { // 读取帧集合 _frames.Clear(); int frameCount = input.ReadUint16(); for (int n = 0; n < frameCount; n++) { } }
//============================================================ public void LoadFile(string fileName) { // 设置初始数据 _fileName = fileName; _columns.Clear(); _rows.Clear(); // 打开文档 Excel.Application application = null; Excel.Workbook workbook = null; // 读取定义 try{ application = new Excel.Application(); application.UserControl = false; application.ScreenUpdating = false; workbook = application.Workbooks.Open(fileName, 0, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); Excel.Worksheet columnsWorksheet = workbook.Worksheets["定义"]; Excel.Worksheet rowsWorksheet = workbook.Worksheets["数据"]; // 读取文件定义 LoadFileColumns(columnsWorksheet); // 读取数据 LoadFileRows(rowsWorksheet); } finally { // 关闭文档 if (null != workbook) { workbook.Close(false); Marshal.ReleaseComObject(workbook); workbook = null; } if (null != application) { // 释放组件 application.Quit(); Marshal.ReleaseComObject(application); // 必须垃圾回收才能释放 int generation = System.GC.GetGeneration(application); application = null; System.GC.Collect(generation); } } workbook = null; application = null; }
//============================================================ // <T>序列化数据到输出流。</T> // // @param output 输出流 // @return 处理结果 //============================================================ public void Clear() { _frames.Clear(); }
//============================================================ // <T>清除所有对象集合。</T> //============================================================ public void Clear() { _collection.Clear(); }