/// <summary> /// Fill listview with data of a non channel file /// Disable Drag and Drop and the connext menu /// </summary> /// <param name="otherFile">Other file</param> public void WriteOtherFile(OtherFile otherFile) { _currentMapFile = null; try { listView1.BeginUpdate(); CreateOtherFileListView(otherFile); _isChannelFile = false; DataTable dt = otherFile.DataTable; foreach (DataRow dr in dt.Rows) { var lvi = new ListViewItem(dr[0].ToString()); for (var i = 1; i < dt.Columns.Count; i++) lvi.SubItems.Add(dr[i].ToString()); listView1.Items.Add(lvi); } } finally { listView1.EndUpdate(); } }
/// <summary> /// Fill listview with data of a non channel file /// Disable Drag and Drop and the connext menu /// </summary> /// <param name="otherFile">Other file</param> public void WriteOtherFile(OtherFile otherFile) { _currentMapFile = null; try { listView1.BeginUpdate(); CreateOtherFileListView(otherFile); _isChannelFile = false; DataTable dt = otherFile.DataTable; foreach (DataRow dr in dt.Rows) { var lvi = new ListViewItem(dr[0].ToString()); for (var i = 1; i < dt.Columns.Count; i++) { lvi.SubItems.Add(dr[i].ToString()); } listView1.Items.Add(lvi); } } finally { listView1.EndUpdate(); } }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if ((treeView1.Nodes.Count <= 0) || (e.Node == treeView1.Nodes[0])) { return; } _currentFilename = e.Node.Text; try { Cursor.Current = Cursors.WaitCursor; // Reorder current map file if its loaded if (_mapFile != null) { ucSingleEdit1.SaveState(); } ucSingleEdit1.Clear(); _mapFile = null; _otherFile = null; if (SCMFile.IsSupportedFile(_currentFilename)) { if (SCMFile.IsChannelMapFile(_currentFilename)) { WriteStatus("Reading channels..."); if (OpenMapFile(_currentFilename)) { WriteChanels(); } } else { WriteStatus("Reading file..."); if (OpenOtherFile(_currentFilename)) { WriteOtherFile(); } } } else { WriteStatus("File not supported."); } } finally { Cursor.Current = Cursors.Default; } }
private bool OpenOtherFile(string filename) { try { _otherFile = _scmFile.GetOtherFile(filename); } catch (Exception ex) { ShowError(ex, "Open file"); return(false); } return(_otherFile != null); }
private void CreateOtherFileListView(OtherFile otherfile) { listView1.Clear(); DataTable dt = otherfile.DataTable; foreach (DataColumn dc in dt.Columns) { listView1.Columns.Add(dc.ColumnName, 100); } if (listView1.Columns.Count > 0) { listView1.Columns[listView1.Columns.Count - 1].Width = -2; } listView1.CheckBoxes = false; listView1.DragAndDropEnabled = false; }
internal OtherFile GetOtherFile(string filename) { OtherFile otherFile = null; var filetype = GetFileType(filename); if (LOG.IsInfoEnabled) { LOG.Debug("Get Other File " + filetype); } if (_otherfiles.ContainsKey(filetype)) { otherFile = _otherfiles[filetype]; } else { switch (filetype) { case SCMFileContentType.cloneInfo: otherFile = new CloneInfoFile(filename, filetype); break; case SCMFileContentType.satDataBase: otherFile = new SatDataBaseFile(filename); break; } if (otherFile != null) { otherFile.ReadFrom(_tempDirectory); _otherfiles.Add(filetype, otherFile); } } return(otherFile); }
private void CreateOtherFileListView(OtherFile otherfile) { listView1.Clear(); DataTable dt = otherfile.DataTable; foreach (DataColumn dc in dt.Columns) listView1.Columns.Add(dc.ColumnName, 100); if (listView1.Columns.Count > 0) listView1.Columns[listView1.Columns.Count - 1].Width = -2; listView1.CheckBoxes = false; listView1.DragAndDropEnabled = false; }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if ((treeView1.Nodes.Count <= 0) || (e.Node == treeView1.Nodes[0])) return; _currentFilename = e.Node.Text; try { Cursor.Current = Cursors.WaitCursor; // Reorder current map file if its loaded if (_mapFile != null) ucSingleEdit1.SaveState(); ucSingleEdit1.Clear(); _mapFile = null; _otherFile = null; if (SCMFile.IsSupportedFile(_currentFilename)) { if (SCMFile.IsChannelMapFile(_currentFilename)) { WriteStatus("Reading channels..."); if (OpenMapFile(_currentFilename)) WriteChanels(); } else { WriteStatus("Reading file..."); if (OpenOtherFile(_currentFilename)) WriteOtherFile(); } } else WriteStatus("File not supported."); } finally { Cursor.Current = Cursors.Default; } }
private bool OpenOtherFile(string filename) { try { _otherFile = _scmFile.GetOtherFile(filename); } catch (Exception ex) { ShowError(ex, "Open file"); return false; } return (_otherFile != null); }