Esempio n. 1
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            DataFrameFilterFactory[] filters = value as DataFrameFilterFactory[];

            if ((filters != null) && (provider != null))
            {
                IWindowsFormsEditorService service = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

                if (service != null)
                {
                    Dictionary<string, Type> typeMap = new Dictionary<string, Type>();
                    typeMap["String"] = typeof(StringDataFrameFilterFactory);
                    typeMap["Binary"] = typeof(BinaryDataFrameFilterFactory);
                    typeMap["Regular Exp"] = typeof(RegexDataFrameFilterFactory);
                    typeMap["Select Count"] = typeof(NodeCountDataFrameFilterFactory);

                    using (ObjectCollectionForm frm = new ObjectCollectionForm(filters, typeMap))
                    {
                        frm.Text = "DataFrame Filter Editor";
                        if (service.ShowDialog(frm) == DialogResult.OK)
                        {
                            value = frm.Objects.Cast<DataFrameFilterFactory>().ToArray();
                        }
                    }
                }
            }

            return value;
        }
Esempio n. 2
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            SequenceChoice[] choices = value as SequenceChoice[];
            SequenceChoiceMemberEntry entry = (SequenceChoiceMemberEntry)ParserUtils.GetCompatibleType(typeof(SequenceChoiceMemberEntry), context.Instance);

            if ((choices != null) && (provider != null) && (entry != null))
            {
                IWindowsFormsEditorService service = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

                if (service != null)
                {
                    Dictionary<string, Func<object>> dict = new Dictionary<string,Func<object>>();

                    dict.Add("New Choice", () => new SequenceChoice(entry));

                    using (ObjectCollectionForm frm = new ObjectCollectionForm(choices, dict))
                    {
                        if (service.ShowDialog(frm) == DialogResult.OK)
                        {
                            value = frm.Objects.Cast<SequenceChoice>().ToArray();
                        }
                    }
                }
            }

            return value;
        }
Esempio n. 3
0
        private void changeColumnsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PacketLogControlConfig config = GeneralUtils.CloneObject(_config);
            Dictionary<string, Type> typeMap = new Dictionary<string,Type>();

            typeMap.Add(Properties.Resources.PacketLogControl_NoColumn, typeof(NumberPacketLogColumn));
            typeMap.Add(Properties.Resources.PacketLogControl_TimestampColumn, typeof(TimestampPacketLogColumn));
            typeMap.Add(Properties.Resources.PacketLogControl_TagColumn, typeof(TagPacketLogColumn));
            typeMap.Add(Properties.Resources.PacketLogControl_NetworkColumn, typeof(NetworkPacketLogColumn));
            typeMap.Add(Properties.Resources.PacketLogControl_DataColumn, typeof(DataPacketLogColumn));
            typeMap.Add(Properties.Resources.PacketLogControl_LengthColumn, typeof(LengthPacketLogColumn));
            typeMap.Add(Properties.Resources.PacketLogControl_HashColumn, typeof(HashPacketLogColumn));
            typeMap.Add(Properties.Resources.PacketLogControl_CustomColumn, typeof(CustomPacketLogColumn));

            using (ObjectCollectionForm frm = new ObjectCollectionForm(config.Columns, typeMap))
            {
                frm.Text = Properties.Resources.PacketLogControl_ColumnEditor;
                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    config.Columns.Clear();
                    config.Columns.AddRange(frm.Objects.Cast<PacketLogColumn>());
                    if (config.Columns.Count == 0)
                    {
                        config.Columns.Add(new NumberPacketLogColumn());
                    }
                    UpdateConfig(config);
                    OnConfigChanged();
                }
               }
        }