private void OnItemCheckedChanged(object sender, ItemCheckedEventArgs e) { ListViewItem lvi = e.Item; if (lvi == null) { Debug.Assert(false); return; } bool bChecked = lvi.Checked; ClviInfo clvi = GetItem(lvi); if (clvi != null) { if (clvi.ReadOnly && (bChecked != clvi.PropertyValue)) { lvi.Checked = clvi.PropertyValue; return; } } foreach (CheckItemLink cl in m_lLinks) { if (cl.Source == lvi) { if (cl.Target.Index < 0) { continue; } if ((cl.Type == CheckItemLinkType.CheckedChecked) && bChecked && !cl.Target.Checked) { cl.Target.Checked = true; } else if ((cl.Type == CheckItemLinkType.UncheckedUnchecked) && !bChecked && cl.Target.Checked) { cl.Target.Checked = false; } else if ((cl.Type == CheckItemLinkType.CheckedUnchecked) && bChecked && cl.Target.Checked) { cl.Target.Checked = false; } else if ((cl.Type == CheckItemLinkType.UncheckedChecked) && !bChecked && !cl.Target.Checked) { cl.Target.Checked = true; } } } }
public ListViewItem CreateItem(object pContainer, string strPropertyName, ListViewGroup lvgContainer, string strDisplayString, bool?obReadOnly) { if (pContainer == null) { throw new ArgumentNullException("pContainer"); } if (strPropertyName == null) { throw new ArgumentNullException("strPropertyName"); } if (strPropertyName.Length == 0) { throw new ArgumentException("strPropertyName"); } if (strDisplayString == null) { throw new ArgumentNullException("strDisplayString"); } if (m_lv == null) { Debug.Assert(false); return(null); } ListViewItem lvi = new ListViewItem(strDisplayString); ClviInfo clvi = new ClviInfo(pContainer, strPropertyName, lvi); if (obReadOnly.HasValue) { clvi.ReadOnly = obReadOnly.Value; } else { DetermineReadOnlyState(clvi); } if (lvgContainer != null) { lvi.Group = lvgContainer; Debug.Assert(lvgContainer.Items.IndexOf(lvi) >= 0); Debug.Assert(m_lv.Groups.IndexOf(lvgContainer) >= 0); } m_lv.Items.Add(lvi); m_lItems.Add(clvi); return(lvi); }
private void DetermineReadOnlyState(ClviInfo clvi) { if (clvi == null) { Debug.Assert(false); return; } if (!m_bUseEnforcedConfig) { clvi.ReadOnly = false; } else { clvi.ReadOnly = AppConfigEx.IsOptionEnforced(clvi.Object, clvi.PropertyInfo); } }
public ListViewItem CreateItem(object pContainer, string strPropertyName, ListViewGroup lvgContainer, string strDisplayString) { if(pContainer == null) throw new ArgumentNullException("pContainer"); if(strPropertyName == null) throw new ArgumentNullException("strPropertyName"); if(strPropertyName.Length == 0) throw new ArgumentException("strPropertyName"); if(strDisplayString == null) throw new ArgumentNullException("strDisplayString"); if(m_lv == null) { Debug.Assert(false); return null; } ListViewItem lvi = new ListViewItem(strDisplayString); ClviInfo clvi = new ClviInfo(pContainer, strPropertyName, lvi); DetermineReadOnlyState(clvi); if(lvgContainer != null) { lvi.Group = lvgContainer; Debug.Assert(lvgContainer.Items.IndexOf(lvi) >= 0); Debug.Assert(m_lv.Groups.IndexOf(lvgContainer) >= 0); } m_lv.Items.Add(lvi); m_lItems.Add(clvi); return lvi; }
private void DetermineReadOnlyState(ClviInfo clvi) { if(clvi == null) { Debug.Assert(false); return; } if(!m_bUseEnforcedConfig) clvi.ReadOnly = false; else clvi.ReadOnly = AppConfigEx.IsOptionEnforced(clvi.Object, clvi.PropertyInfo); }