Example #1
0
        private void listViewProperties_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (listViewProperties.SelectedItems.Count > 0)
            {
                PropertyInfo pi = (PropertyInfo)listViewProperties.SelectedItems[0].Tag;

                if (pi.CanWrite)
                {
                    object val = null;

                    try
                    {
                        if (pi.CanRead)
                        {
                            val = pi.GetValue(m_pObject, null);
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.ToString());
                        val = null;
                    }

                    using (GetTypeForm frm = new GetTypeForm(pi.PropertyType, val))
                    {
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            try
                            {
                                pi.SetValue(m_pObject, frm.Data, null);
                            }
                            catch (Exception ex)
                            {
                                System.Diagnostics.Debug.WriteLine(ex.ToString());
                            }
                            UpdateProperties();
                        }
                    }
                }
            }
        }
Example #2
0
        private void listViewParameters_DoubleClick(object sender, EventArgs e)
        {
            if (listViewParameters.SelectedItems.Count > 0)
            {
                ListViewItem item = listViewParameters.SelectedItems[0];
                ParamData    data = (ParamData)item.Tag;

                Type baseType = data.pi.ParameterType;

                if (baseType.GetElementType() != null)
                {
                    baseType = baseType.GetElementType();
                }

                if (baseType == typeof(IStream))
                {
                    using (CreateIStreamForm frm = new CreateIStreamForm())
                    {
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            data.data = frm.Stream;
                        }
                    }
                }
                else
                {
                    using (GetTypeForm frm = new GetTypeForm(data.pi.ParameterType, data.data))
                    {
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            data.data = frm.Data;
                        }
                    }
                }

                RefreshParameters();
            }
        }