コード例 #1
0
ファイル: FormIpfixTemplate.cs プロジェクト: sshaky2/NetFlow
        public FormIpfixTemplate(FormIpfixTemplateList p)
        {
            InitializeComponent();
            for (int i = 1; i < TemplateItem.Length; ++i)
            {
                if (TemplateItem[i] != "RESERVED")
                {
                    listBoxAll.Items.Add(TemplateItem[i]);
                }
            }
            this.parent = p;
            ushort nextId = 256;

            foreach (netflow.IpfixTemplate t in parent.TemplateList)
            {
                if (t.TemplateId >= nextId)
                {
                    ++nextId;
                }
            }
            textBoxTemplateId.Text = nextId.ToString();
            btnAdd.Enabled         = false;
        }
コード例 #2
0
        private void chklstFlowVersion_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (chklstFlowVersion.SelectedIndex == (int)FlowVersionList.V8 &&
                chklstFlowVersion.GetItemChecked((int)FlowVersionList.V8))
            {
                if (lstboxV8Aggregation.InvokeRequired)
                {
                    this.Invoke(new EventHandler(chklstFlowVersion_SelectedIndexChanged),
                                new object[] { sender, e });
                    return;
                }
                lstboxV8Aggregation.Visible = true;
                if (lstboxV8Aggregation.SelectedIndices.Count == 0)
                {
                    lstboxV8Aggregation.SetSelected(0, true);
                }
                v8aggregation = lstboxV8Aggregation.SelectedIndex + 1;
            }
            else
            {
                lstboxV8Aggregation.Visible = false;
            }

            if (chklstFlowVersion.SelectedIndex == (int)FlowVersionList.V9 &&
                chklstFlowVersion.GetItemChecked((int)FlowVersionList.V9))
            {
                if (v9Templates == null)
                {
                    v9Templates = new ArrayList();
                }
                V9TemplateList form = new V9TemplateList();
                form.StartPosition = FormStartPosition.CenterParent;
                form.V9Templates   = v9Templates;
                if (form.ShowDialog() != DialogResult.OK)
                {
                    chklstFlowVersion.SetItemChecked((int)FlowVersionList.V9, false);
                }
            }
            if (chklstFlowVersion.SelectedIndex == (int)FlowVersionList.IPFIX &&
                chklstFlowVersion.GetItemChecked((int)FlowVersionList.IPFIX))
            {
                if (ipfixTemplates == null)
                {
                    ipfixTemplates = new ArrayList();
                }
                FormIpfixTemplateList form = new FormIpfixTemplateList();
                form.StartPosition  = FormStartPosition.CenterParent;
                form.IpfixTemplates = ipfixTemplates;
                if (form.ShowDialog() != DialogResult.OK)
                {
                    chklstFlowVersion.SetItemChecked((int)FlowVersionList.IPFIX, false);
                }
            }
            if (chklstFlowVersion.SelectedIndex == (int)FlowVersionList.SFLOW)
            {
                if (checkedListBoxSFlowVersion.InvokeRequired)
                {
                    this.Invoke(new EventHandler(chklstFlowVersion_SelectedIndexChanged),
                                new object[] { sender, e });
                    return;
                }
                bool hasOneCounterChecked = false;
                for (int i = 0; i < sFlowVersions.Length; ++i)
                {
                    if (sFlowVersions[i] == true)
                    {
                        hasOneCounterChecked = true;
                        break;
                    }
                }
                if (!hasOneCounterChecked)
                {
                    checkedListBoxSFlowVersion.SetItemChecked(0, true);
                }
                checkedListBoxSFlowVersion.Visible = true;
            }
            else
            {
                checkedListBoxSFlowVersion.Visible = false;
            }
        }