private void ProcessItemSelection() { if (this.DialogResult == DialogResult.OK) { return; // Already closing } ListView.SelectedListViewItemCollection lvsic = m_lvFields.SelectedItems; if ((lvsic == null) || (lvsic.Count != 1)) { Debug.Assert(false); return; } ListViewItem lvi = lvsic[0]; if (lvi == null) { Debug.Assert(false); return; } FpField fpf = (lvi.Tag as FpField); if (fpf == null) { Debug.Assert(false); return; } m_fpResult = fpf; this.DialogResult = DialogResult.OK; }
internal static FpField ShowAndRestore(string strTitle, string strText, List <FpField> lFields) { IntPtr h = IntPtr.Zero; try { h = NativeMethods.GetForegroundWindowHandle(); } catch (Exception) { Debug.Assert(false); } FieldPickerForm dlg = new FieldPickerForm(); dlg.InitEx(strTitle, strText, lFields); FpField fpResult = null; if (UIUtil.ShowDialogAndDestroy(dlg) == DialogResult.OK) { fpResult = dlg.SelectedField; } try { if (h != IntPtr.Zero) { NativeMethods.EnsureForegroundWindow(h); } } catch (Exception) { Debug.Assert(false); } return(fpResult); }
private void ProcessItemSelection() { if(this.DialogResult == DialogResult.OK) return; // Already closing ListView.SelectedListViewItemCollection lvsic = m_lvFields.SelectedItems; if((lvsic == null) || (lvsic.Count != 1)) { Debug.Assert(false); return; } ListViewItem lvi = lvsic[0]; if(lvi == null) { Debug.Assert(false); return; } FpField fpf = (lvi.Tag as FpField); if(fpf == null) { Debug.Assert(false); return; } m_fpResult = fpf; this.DialogResult = DialogResult.OK; }