/* D O V I E W S A V E */ /*---------------------------------------------------------------------------- * %%Function: DoViewSave * %%Qualified: AzLog.AzLogWindow.DoViewSave * %%Contact: rlittle * * Save all the current view settings * ----------------------------------------------------------------------------*/ private void DoViewSave(object sender, EventArgs e) { AzLogViewSettings azlvs = (AzLogViewSettings)m_cbView.SelectedItem; if (azlvs == null || azlvs.Name == "<New...>") { CreateNewView(); } Dictionary <string, int> rgColumns = new Dictionary <string, int>(); for (int i = 0; i < m_lvLog.Columns.Count; i++) { rgColumns.Add(m_lvLog.Columns[i].Text, i); } for (int i = 0; i < m_azlvs.ColumnCount(); i++) { string sName = m_azlvs.Column(i).Name; // only sync the width here. all else sync during manipulation if (rgColumns.ContainsKey(sName)) { m_azlvs.Column(i).Width = m_lvLog.Columns[rgColumns[sName]].Width; } } m_azlvs.Save(); m_ilc.SetDefaultView(m_azlvs.Name); DirtyView(false); }
/* S E T U P L I S T V I E W F O R L O G */ /*---------------------------------------------------------------------------- * %%Function: SetupListViewForView * %%Qualified: AzLog.AzLogWindow.SetupListViewForView * %%Contact: rlittle * * Initialize the view to match the given view * ----------------------------------------------------------------------------*/ private void SetupListViewForView(AzLogViewSettings azlvs) { int i; m_lvLog.BeginUpdate(); m_lvLog.Columns.Clear(); //for (i = m_lvLog.Columns.Count - 1; i >= 0; --i) //m_lvLog.Columns.RemoveAt(i); for (i = 0; i < azlvs.ColumnCount(); i++) { AzLogViewSettings.AzLogViewColumn azlvc = azlvs.Column(i); m_lvLog.Columns.Add(new ColumnHeader()); m_lvLog.Columns[i].Text = azlvc.Title; m_lvLog.Columns[i].Tag = azlvc.Name; m_lvLog.Columns[i].Width = azlvc.Width; } if (m_azlv != null) { m_azlv.BumpGeneration(); } m_lvLog.EndUpdate(); // m_lvLog.VirtualListSize = 0; }
/* S E T U P L I S T V I E W F O R L O G */ /*---------------------------------------------------------------------------- %%Function: SetupListViewForView %%Qualified: AzLog.AzLogWindow.SetupListViewForView %%Contact: rlittle Initialize the view to match the given view ----------------------------------------------------------------------------*/ private void SetupListViewForView(AzLogViewSettings azlvs) { int i; m_lvLog.BeginUpdate(); m_lvLog.Columns.Clear(); //for (i = m_lvLog.Columns.Count - 1; i >= 0; --i) //m_lvLog.Columns.RemoveAt(i); for (i = 0; i < azlvs.ColumnCount(); i++) { AzLogViewSettings.AzLogViewColumn azlvc = azlvs.Column(i); m_lvLog.Columns.Add(new ColumnHeader()); m_lvLog.Columns[i].Text = azlvc.Title; m_lvLog.Columns[i].Tag = azlvc.Name; m_lvLog.Columns[i].Width = azlvc.Width; } if (m_azlv != null) m_azlv.BumpGeneration(); m_lvLog.EndUpdate(); // m_lvLog.VirtualListSize = 0; }