Beispiel #1
0
        private void UpdateLayout()
        {
            Layout.ClearLayout();

            var index = 0;

            foreach (var componentLog in Parameters.ComponentLogs)
            {
                using (Layout.BeginGroupBox(new GroupBox {
                    Text = $"Component {++index}"
                }))
                {
                    var module = new ComboBox {
                        DropDownStyle = ComboBoxStyle.DropDownList
                    };
                    module.Items.AddRange(Apex.EnumUtil.GetValuesCombo <LogModule>());
                    module.SelectedItem          = componentLog.LoggingModule;
                    module.SelectedIndexChanged += (object sender, EventArgs e) => { componentLog.LoggingModule = (LogModule)module.SelectedItem; };

                    var level = new ComboBox {
                        DropDownStyle = ComboBoxStyle.DropDownList
                    };
                    level.Items.AddRange(Apex.EnumUtil.GetValuesCombo <LogLevel>());
                    level.SelectedItem          = componentLog.LoggingLevel;
                    level.SelectedIndexChanged += (object sender, EventArgs e) => { componentLog.LoggingLevel = (LogLevel)level.SelectedItem; };

                    var delete = new Button {
                        Text = "Delete Module"
                    };
                    delete.Click += (object sender, EventArgs e) => { DeleteModule(componentLog); };

                    using (Layout.BeginRow())
                    {
                        Layout.AddControl(new Label {
                            Text = "Logging Module"
                        });
                        Layout.AddControl(module);
                    }

                    using (Layout.BeginRow())
                    {
                        Layout.AddControl(new Label {
                            Text = "Logging Level"
                        });
                        Layout.AddControl(level);
                    }

                    Layout.AddControl(delete);
                }
            }

            Layout.AddControl(btnNew);

            Layout.ProcessLayout();
        }
Beispiel #2
0
        public void TestLayoutCalculation_Basic()
        {
            var layoutEngine  = new LayoutEngine();
            var componentTree = new ElementTree(null);
            var testData      = new BasicTestData(componentTree);

            var result = layoutEngine.ProcessLayout(new AbsoluteSize(800, 600), componentTree);

            Assert.Equal(0, result.GetLayoutBoxInformation(testData.ComponentTop).AbsoluteBox.Top);
            Assert.Equal(800, result.GetLayoutBoxInformation(testData.ComponentTop).AbsoluteBox.Right);
            Assert.Equal(50, result.GetLayoutBoxInformation(testData.ComponentTop).AbsoluteBox.Bottom);
            Assert.Equal(0, result.GetLayoutBoxInformation(testData.ComponentTop).AbsoluteBox.Left);

            Assert.Equal(50, result.GetLayoutBoxInformation(testData.ComponentBottom).AbsoluteBox.Top);
            Assert.Equal(800, result.GetLayoutBoxInformation(testData.ComponentBottom).AbsoluteBox.Right);
            Assert.Equal(600, result.GetLayoutBoxInformation(testData.ComponentBottom).AbsoluteBox.Bottom);
            Assert.Equal(0, result.GetLayoutBoxInformation(testData.ComponentBottom).AbsoluteBox.Left);

            Assert.Equal(50, result.GetLayoutBoxInformation(testData.ComponentLeft).AbsoluteBox.Top);
            Assert.Equal(200, result.GetLayoutBoxInformation(testData.ComponentLeft).AbsoluteBox.Right);
            Assert.Equal(130, result.GetLayoutBoxInformation(testData.ComponentLeft).AbsoluteBox.Bottom);
            Assert.Equal(0, result.GetLayoutBoxInformation(testData.ComponentLeft).AbsoluteBox.Left);

            Assert.Equal(50, result.GetLayoutBoxInformation(testData.ComponentLeft1).AbsoluteBox.Top);
            Assert.Equal(200, result.GetLayoutBoxInformation(testData.ComponentLeft1).AbsoluteBox.Right);
            Assert.Equal(90, result.GetLayoutBoxInformation(testData.ComponentLeft1).AbsoluteBox.Bottom);
            Assert.Equal(0, result.GetLayoutBoxInformation(testData.ComponentLeft1).AbsoluteBox.Left);

            Assert.Equal(90, result.GetLayoutBoxInformation(testData.ComponentLeft2).AbsoluteBox.Top);
            Assert.Equal(200, result.GetLayoutBoxInformation(testData.ComponentLeft2).AbsoluteBox.Right);
            Assert.Equal(130, result.GetLayoutBoxInformation(testData.ComponentLeft2).AbsoluteBox.Bottom);
            Assert.Equal(0, result.GetLayoutBoxInformation(testData.ComponentLeft2).AbsoluteBox.Left);

            Assert.Equal(50, result.GetLayoutBoxInformation(testData.ComponentRight).AbsoluteBox.Top);
            Assert.Equal(800, result.GetLayoutBoxInformation(testData.ComponentRight).AbsoluteBox.Right);
            Assert.Equal(600, result.GetLayoutBoxInformation(testData.ComponentRight).AbsoluteBox.Bottom);
            Assert.Equal(200, result.GetLayoutBoxInformation(testData.ComponentRight).AbsoluteBox.Left);

            Assert.Equal(50, result.GetLayoutBoxInformation(testData.ComponentRight1).AbsoluteBox.Top);
            Assert.Equal(800, result.GetLayoutBoxInformation(testData.ComponentRight1).AbsoluteBox.Right);
            Assert.Equal(90, result.GetLayoutBoxInformation(testData.ComponentRight1).AbsoluteBox.Bottom);
            Assert.Equal(200, result.GetLayoutBoxInformation(testData.ComponentRight1).AbsoluteBox.Left);

            Assert.Equal(90, result.GetLayoutBoxInformation(testData.ComponentRight2).AbsoluteBox.Top);
            Assert.Equal(800, result.GetLayoutBoxInformation(testData.ComponentRight2).AbsoluteBox.Right);
            Assert.Equal(170, result.GetLayoutBoxInformation(testData.ComponentRight2).AbsoluteBox.Bottom);
            Assert.Equal(200, result.GetLayoutBoxInformation(testData.ComponentRight2).AbsoluteBox.Left);
        }
Beispiel #3
0
        public void RefreshTraces()
        {
            Layout.ClearLayout();

            foreach (var trace in Parent.NetworkParameters.Traces)
            {
                using (Layout.BeginGroupBox(new GroupBox {
                    Text = trace.Name
                }))
                {
                    if (trace.Attributes != null)
                    {
                        foreach (var traceAttribute in trace.Attributes)
                        {
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(new Label()
                                {
                                    Text = traceAttribute.ToString()
                                });
                            }
                        }
                    }
                    using (Layout.BeginRow())
                    {
                        var editButton = new Button()
                        {
                            Text = "Edit"
                        };
                        editButton.Click += (object sender, EventArgs e) => { EditTrace(trace); };
                        var deleteButton = new Button()
                        {
                            Text = "Delete"
                        };
                        deleteButton.Click += (object sender, EventArgs e) => { DeleteTrace(trace); };
                        Layout.AddControl(editButton);
                        Layout.AddControl(deleteButton);
                    }
                }
            }

            Layout.ProcessLayout();
        }
Beispiel #4
0
        private void UpdateNodeLayout()
        {
            NodeLayout.ClearLayout();

            while (pnlNodes.Controls.Count > 0)
            {
                pnlNodes.Controls[0].Dispose();
                pnlNodes.Controls.RemoveAt(0);
            }

            var oddNode = true;

            foreach (var node in Parent.Nodes)
            {
                if (oddNode)
                {
                    NodeLayout.BeginRow();
                }

                var checkBox = new CheckBox
                {
                    Text    = node.Text,
                    Checked = DomainLink.Nodes.Contains(node),
                    Tag     = node
                };
                NodeLayout.AddControl(checkBox);

                if (!oddNode)
                {
                    NodeLayout.EndRow();
                }
                oddNode = !oddNode;
            }

            if (!oddNode)
            {
                NodeLayout.EndRow();
            }

            NodeLayout.ProcessLayout();

            Apex.ControlUtil.ShowScrollBar(pnlNodes.Handle, Apex.ControlUtil.ScrollBarDirection.Horizontal, false);
        }
Beispiel #5
0
        public void RefreshPlots()
        {
            Layout.ClearLayout();

            foreach (var plot in Parent.NetworkParameters.Plots)
            {
                using (Layout.BeginGroupBox(new GroupBox {
                    Text = $"{plot.Name} ({plot.Width}x{plot.Height})"
                }))
                {
                    foreach (var attribute in plot.Attributes)
                    {
                        using (Layout.BeginRow())
                        {
                            Layout.AddControl(new Label()
                            {
                                Text = attribute.ToString()
                            });
                        }
                    }

                    using (Layout.BeginRow())
                    {
                        var editButton = new Button()
                        {
                            Text = "Edit"
                        };
                        editButton.Click += (object sender, EventArgs e) => { EditPlot(plot); };
                        var deleteButton = new Button()
                        {
                            Text = "Delete"
                        };
                        deleteButton.Click += (object sender, EventArgs e) => { DeletePlot(plot); };
                        Layout.AddControl(editButton);
                        Layout.AddControl(deleteButton);
                    }
                }
            }

            Layout.ProcessLayout();
        }
Beispiel #6
0
        public void LoadTrace(Trace Trace, bool New = true)
        {
            // Don't update link if the trace was updated by this form.
            if (New)
            {
                // Clone object and keep a reference to the original so we can quit without saving.
                TraceLink    = Trace;
                CurrentTrace = new Trace(Trace);
                Trace        = CurrentTrace;
            }

            txtName.Text         = Trace.Name;
            txtStartTime.Text    = Trace.StartTime.ToString();
            txtEndTime.Text      = Trace.EndTime.ToString();
            chkStartTime.Checked = Trace.CommonStartTime;
            chkEndTime.Checked   = Trace.CommonEndTime;

            if (Trace.Attributes == null)
            {
                Trace.Attributes = new List <TraceAttribute>();
            }

            if (Trace.Attributes.Count == 0)
            {
                AddAttribute(Trace);
            }

            Layout.ClearLayout();

            using (Layout.BeginRow())
            {
                Layout.AddControl(lblName);
                Layout.AddControl(txtName);
            }

            using (Layout.BeginRow())
            {
                Layout.AddControl(chkStartTime);
                Layout.AddControl(txtStartTime);
            }

            using (Layout.BeginRow())
            {
                Layout.AddControl(chkEndTime);
                Layout.AddControl(txtEndTime);
            }

            using (Layout.BeginPanel(pnlAttributes))
            {
                var index = 0;
                foreach (var attribute in Trace.Attributes)
                {
                    using (Layout.BeginGroupBox(new GroupBox {
                        Text = $"Attribute {++index}"
                    }))
                    {
                        var attributeCombo = new ComboBox {
                            DropDownStyle = ComboBoxStyle.DropDownList
                        };
                        var elementCombo = new ComboBox {
                            DropDownStyle = ComboBoxStyle.DropDownList
                        };
                        var code = new TextBox
                        {
                            Text    = attribute.Code,
                            Enabled = attribute.IncrementMode == TraceAttribute.Increment.Custom
                        };
                        var deleteButton = new Button {
                            Text = "Delete Attribute"
                        };
                        var evaluationCombo = new ComboBox {
                            DropDownStyle = ComboBoxStyle.DropDownList
                        };

                        #region "Element Source"
                        elementCombo.Items.AddRange(Parent.Parent.Items.ToArray());
                        elementCombo.SelectedItem          = attribute.Element;
                        elementCombo.SelectedValueChanged += (object sender, EventArgs e) =>
                        {
                            attribute.Element = (IDrawable)elementCombo.SelectedItem;
                            LoadTrace(Trace, false);
                        };

                        if (attribute.Element is Node || attribute.Element is Domain)
                        {
                            attributeCombo.Items.AddRange(new string[] { "MacTx", "MacTxDrop", "MacRx", "PhyTxEnd", "PhyTxDrop", "PhyRxEnd", "PhyRxDrop", "Tx", "Rx", "SendOutgoing", "UnicastForward", "LocalDeliver", "Enqueue", "Dequeue", "Drop" });
                        }
                        else if (attribute.Element is Link)
                        {
                            attributeCombo.Items.AddRange(new string[] { "MacTx", "MacTxDrop", "MacRx", "PhyTxBegin", "PhyTxEnd", "PhyTxDrop", "PhyRxEnd", "PhyRxDrop", "Enqueue", "Dequeue", "Drop" });
                        }
                        else if (attribute.Element is Stream)
                        {
                            attributeCombo.Items.AddRange(new string[] { "Tx", "Rx", "CongestionWindow" });
                        }
                        attributeCombo.SelectedItem = attribute.TraceSource;

                        // Element type has changed the old source no longer exists.
                        if (attributeCombo.SelectedIndex == -1)
                        {
                            attributeCombo.SelectedIndex = 0;
                            attribute.TraceSource        = attributeCombo.SelectedItem as string;
                        }

                        using (Layout.BeginRow())
                        {
                            Layout.AddControl(new Label {
                                Text = "Element Source"
                            });
                            Layout.AddControl(elementCombo);
                        }
                        #endregion

                        if (attribute.Element is Stream)
                        {
                            Layout.AddControl(new Label {
                                Text = $"Direction: {(attribute.Element as Stream).StartNode.Text} -> {(attribute.Element as Stream).EndNode.Text}"
                            });
                        }

                        if (attribute.Element is Link)
                        {
                            var start = attribute.LinkReverse ? (attribute.Element as Link).EndNode : (attribute.Element as Link).StartNode;
                            var end   = attribute.LinkReverse ? (attribute.Element as Link).StartNode : (attribute.Element as Link).EndNode;

                            var direction = new Label {
                                Text = $"Direction: {start.Text} -> {end.Text}"
                            };
                            var reverse = new CheckBox
                            {
                                Text    = "Reverse",
                                Checked = attribute.LinkReverse
                            };
                            reverse.CheckedChanged += (object sender, EventArgs e) =>
                            {
                                attribute.LinkReverse = reverse.Checked;
                                direction.Text        = $"Direction: {(reverse.Checked ? end.Text : start.Text)} -> {(reverse.Checked ? start.Text : end.Text)}";
                            };

                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(direction);
                                Layout.AddControl(reverse);
                            }
                        }

                        #region "Attribute Source"
                        attributeCombo.SelectedValueChanged += (object sender, EventArgs e) =>
                        {
                            attribute.TraceSource = attributeCombo.SelectedItem as string;
                            code.Text             = attribute.Code;
                        };
                        using (Layout.BeginRow())
                        {
                            Layout.AddControl(new Label {
                                Text = "Attribute Source"
                            });
                            Layout.AddControl(attributeCombo);
                        }
                        #endregion

                        #region "Delete Row"
                        using (Layout.BeginRow())
                        {
                            deleteButton.Click += (object sender, EventArgs e) => { DeleteAttribute(Trace, attribute); };
                            Layout.AddControl(new Label {
                                Text = "Evaluation Code"
                            });
                            Layout.AddControl(deleteButton);
                        }
                        #endregion


                        #region "Evaluation"
                        code.TextChanged += (object sender, EventArgs e) =>
                        {
                            if ((sender as TextBox).Enabled)
                            {
                                attribute.Code = (sender as TextBox).Text;
                            }
                        };

                        evaluationCombo.Items.AddRange(new object[] { TraceAttribute.Increment.PacketIncrement, TraceAttribute.Increment.PacketDecrement, TraceAttribute.Increment.PacketSizeIncrement, TraceAttribute.Increment.PacketSizeDecrement, TraceAttribute.Increment.Custom });
                        evaluationCombo.SelectedItem          = attribute.IncrementMode;
                        evaluationCombo.SelectedValueChanged += (object sender, EventArgs e) =>
                        {
                            attribute.IncrementMode = (TraceAttribute.Increment)evaluationCombo.SelectedItem;
                            code.Enabled            = attribute.IncrementMode == TraceAttribute.Increment.Custom;
                            code.Text = attribute.Code;
                        };

                        using (Layout.BeginRow())
                        {
                            Layout.AddControl(evaluationCombo);
                            Layout.AddControl(code);
                        }
                        #endregion
                    }
                }
            }

            var btnAddAttribute = new Button {
                Text = "Add attribute"
            };
            btnAddAttribute.Click += (object sender, EventArgs e) =>
            {
                AddAttribute(Trace);
                LoadTrace(Trace, false);
            };
            Layout.AddControl(btnAddAttribute);

            using (Layout.BeginRow())
            {
                Layout.AddControl(btnSave);
                Layout.AddControl(btnDelete);
            }

            Layout.ProcessLayout();

            // Shrink attributes panel so it doesn't go off the bottom of the form.
            if (btnSave.Bottom > ClientSize.Height)
            {
                pnlAttributes.Height -= (btnSave.Bottom - ClientSize.Height);
                pnlAttributes.Left   -= 8;
                pnlAttributes.Width  += 16;
                btnAddAttribute.Top   = pnlAttributes.Bottom + 6;
                btnSave.Top           = btnAddAttribute.Bottom + 6;
                btnDelete.Top         = btnAddAttribute.Bottom + 6;
                Apex.ControlUtil.ShowScrollBar(pnlAttributes.Handle, Apex.ControlUtil.ScrollBarDirection.Horizontal, false);
            }
        }
Beispiel #7
0
        public void LoadPlot(Plot Plot, bool New = true)
        {
            var controlPairs = new Tuple <Control, Control>[]
            {
                new Tuple <Control, Control>(lblName, txtName),
                new Tuple <Control, Control>(lblLegend, cmbLegend),
                new Tuple <Control, Control>(pnlWidth, pnlHeight),
                new Tuple <Control, Control>(lblXAxis, txtXAxis),
                new Tuple <Control, Control>(lblYAxis, txtYAxis),
                new Tuple <Control, Control>(lblY2Axis, txtY2Axis)
            };

            // Don't update link if the plot was updated by this form.
            if (New)
            {
                // Clone object and keep a reference to the original so we can quit without saving.
                PlotLink    = Plot;
                CurrentPlot = new Plot(Plot);
                Plot        = CurrentPlot;
            }

            txtName.Text           = Plot.Name;
            cmbLegend.SelectedItem = Plot.LegendLocation;
            txtWidth.Text          = Plot.Width.ToString();
            txtHeight.Text         = Plot.Height.ToString();
            txtXAxis.Text          = Plot.XAxisLabel;
            txtYAxis.Text          = Plot.YAxisLabel;
            txtY2Axis.Text         = Plot.Y2AxisLabel;
            chkDisabled.Checked    = Plot.Disabled;

            if (Plot.Attributes.Count == 0)
            {
                AddAttribute(Plot);
            }

            Layout.ClearLayout();
            if (this.Width > 500)
            {
                for (int i = 0; i < controlPairs.Length; i += 2)
                {
                    using (Layout.BeginRow())
                    {
                        Layout.AddControl(controlPairs[i].Item1);
                        Layout.AddControl(controlPairs[i].Item2);
                        if (controlPairs.Length > i + 1)
                        {
                            Layout.AddControl(controlPairs[i + 1].Item1);
                            Layout.AddControl(controlPairs[i + 1].Item2);
                        }
                    }
                }
            }
            else
            {
                foreach (var pair in controlPairs)
                {
                    using (Layout.BeginRow())
                    {
                        Layout.AddControl(pair.Item1);
                        Layout.AddControl(pair.Item2);
                    }
                }
            }

            using (Layout.BeginPanel(pnlAttributes))
            {
                var index = 0;
                foreach (var attribute in Plot.Attributes)
                {
                    using (Layout.BeginGroupBox(new GroupBox {
                        Text = $"Attribute {++index}"
                    }))
                    {
                        var cmbParameter = new ComboBox {
                            DropDownStyle = ComboBoxStyle.DropDownList
                        };
                        cmbParameter.Items.AddRange(Parent.Parent.NetworkParameters.Traces.ToArray());
                        cmbParameter.SelectedItem          = attribute.TraceParameter;
                        cmbParameter.SelectedIndexChanged += (object sender, EventArgs e) =>
                        {
                            attribute.TraceParameter = (Trace)cmbParameter.SelectedItem;
                        };

                        var cmbAveragingType = new ComboBox {
                            DropDownStyle = ComboBoxStyle.DropDownList
                        };
                        cmbAveragingType.Items.AddRange(Apex.EnumUtil.GetValuesCombo <PlotAttribute.Averaging>());
                        cmbAveragingType.SelectedItem          = attribute.AveragingType;
                        cmbAveragingType.SelectedIndexChanged += (object sender, EventArgs e) =>
                        {
                            attribute.AveragingType = (PlotAttribute.Averaging)cmbAveragingType.SelectedItem;
                        };

                        var cmbPlotType = new ComboBox {
                            DropDownStyle = ComboBoxStyle.DropDownList
                        };
                        cmbPlotType.Items.AddRange(Apex.EnumUtil.GetValuesCombo <PlotAttribute.PlotType>());
                        cmbPlotType.SelectedItem          = attribute.Type;
                        cmbPlotType.SelectedIndexChanged += (object sender, EventArgs e) =>
                        {
                            attribute.Type = (PlotAttribute.PlotType)cmbPlotType.SelectedItem;
                        };

                        var txtWindowSize = new TextBox {
                            Text = attribute.WindowWidth.ToString()
                        };
                        txtWindowSize.KeyPress    += Apex.InputFiltering.FilterNumeric;
                        txtWindowSize.TextChanged += (object sender, EventArgs e) =>
                        {
                            attribute.WindowWidth = float.Parse(txtWindowSize.Text);
                        };

                        var txtModulo = new TextBox
                        {
                            Text    = attribute.ModuloValue.ToString(),
                            Enabled = attribute.ModuloEnabled
                        };
                        txtModulo.KeyPress    += Apex.InputFiltering.FilterNumeric;
                        txtModulo.TextChanged += (object sender, EventArgs e) =>
                        {
                            attribute.ModuloValue = float.Parse(txtModulo.Text);
                        };

                        var chkModulo = new CheckBox
                        {
                            Text    = "Modulo",
                            Checked = attribute.ModuloEnabled
                        };
                        chkModulo.CheckedChanged += (object sender, EventArgs e) =>
                        {
                            attribute.ModuloEnabled = chkModulo.Checked;
                            txtModulo.Enabled       = chkModulo.Checked;
                        };

                        var txtMin = new TextBox
                        {
                            Text    = attribute.MinValue.ToString(),
                            Enabled = attribute.MinEnabled
                        };
                        txtMin.KeyPress    += Apex.InputFiltering.FilterNumeric;
                        txtMin.TextChanged += (object sender, EventArgs e) =>
                        {
                            attribute.MinValue = float.Parse(txtMin.Text);
                        };

                        var chkMin = new CheckBox
                        {
                            Text    = "Min",
                            Checked = attribute.MinEnabled
                        };
                        chkMin.CheckedChanged += (object sender, EventArgs e) =>
                        {
                            attribute.MinEnabled = chkMin.Checked;
                            txtMin.Enabled       = chkMin.Checked;
                        };

                        var txtMax = new TextBox
                        {
                            Text    = attribute.MaxValue.ToString(),
                            Enabled = attribute.MaxEnabled
                        };
                        txtMax.KeyPress    += Apex.InputFiltering.FilterNumeric;
                        txtMax.TextChanged += (object sender, EventArgs e) =>
                        {
                            attribute.MaxValue = float.Parse(txtMax.Text);
                        };

                        var chkMax = new CheckBox
                        {
                            Text    = "Max",
                            Checked = attribute.MaxEnabled
                        };
                        chkMax.CheckedChanged += (object sender, EventArgs e) =>
                        {
                            attribute.MaxEnabled = chkMax.Checked;
                            txtMax.Enabled       = chkMax.Checked;
                        };

                        var txtScaleData = new TextBox
                        {
                            Text    = attribute.ScaleDataCommand,
                            Enabled = attribute.ScaleData
                        };
                        txtScaleData.TextChanged += (object sender, EventArgs e) =>
                        {
                            attribute.ScaleDataCommand = txtScaleData.Text;
                        };

                        var chkScaleData = new CheckBox
                        {
                            Text    = "Scale Data",
                            Checked = attribute.ScaleData
                        };
                        chkScaleData.CheckedChanged += (object sender, EventArgs e) =>
                        {
                            attribute.ScaleData  = chkScaleData.Checked;
                            txtScaleData.Enabled = chkScaleData.Checked;
                        };

                        var chkY2 = new CheckBox
                        {
                            Text    = "Use Y2 Axis",
                            Checked = attribute.UseY2Axis
                        };
                        chkY2.CheckedChanged += (object sender, EventArgs e) =>
                        {
                            attribute.UseY2Axis = chkY2.Checked;
                        };

                        var chkShowPoints = new CheckBox
                        {
                            Text    = "Show Points",
                            Checked = attribute.ShowPoints
                        };
                        chkShowPoints.CheckedChanged += (object sender, EventArgs e) =>
                        {
                            attribute.ShowPoints = chkShowPoints.Checked;
                        };

                        var chkShowLines = new CheckBox
                        {
                            Text    = "Show Lines",
                            Checked = attribute.ShowLines
                        };
                        chkShowLines.CheckedChanged += (object sender, EventArgs e) =>
                        {
                            attribute.ShowLines = chkShowLines.Checked;
                        };

                        var btnDeleteAttribute = new Button
                        {
                            Text = "Delete Attribute"
                        };
                        btnDeleteAttribute.Click += (object sender, EventArgs e) => { DeleteAttribute(Plot, attribute); };

                        // Put twice as much stuff on one line if there is space.
                        if (this.Width > 500)
                        {
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(new Label {
                                    Text = "Traced Parameter"
                                });
                                Layout.AddControl(cmbParameter);
                                Layout.AddControl(new Label {
                                    Text = "Window Width"
                                });
                                Layout.AddControl(txtWindowSize);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(new Label {
                                    Text = "Averaging Type"
                                });
                                Layout.AddControl(cmbAveragingType);
                                Layout.AddControl(new Label {
                                    Text = "Plot Type"
                                });
                                Layout.AddControl(cmbPlotType);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(chkModulo);
                                Layout.AddControl(txtModulo);
                                Layout.AddControl(chkScaleData);
                                Layout.AddControl(txtScaleData);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(chkMin);
                                Layout.AddControl(txtMin);
                                Layout.AddControl(chkMax);
                                Layout.AddControl(txtMax);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(chkY2);
                                Layout.AddControl(chkShowPoints);
                                Layout.AddControl(chkShowLines);
                                Layout.AddControl(btnDeleteAttribute);
                            }
                        }
                        else
                        {
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(new Label {
                                    Text = "Traced Parameter"
                                });
                                Layout.AddControl(cmbParameter);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(new Label {
                                    Text = "Window Width"
                                });
                                Layout.AddControl(txtWindowSize);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(new Label {
                                    Text = "Averaging Type"
                                });
                                Layout.AddControl(cmbAveragingType);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(new Label {
                                    Text = "Plot Type"
                                });
                                Layout.AddControl(cmbPlotType);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(chkModulo);
                                Layout.AddControl(txtModulo);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(chkScaleData);
                                Layout.AddControl(txtScaleData);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(chkMin);
                                Layout.AddControl(txtMin);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(chkMax);
                                Layout.AddControl(txtMax);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(chkY2);
                                Layout.AddControl(chkShowPoints);
                            }
                            using (Layout.BeginRow())
                            {
                                Layout.AddControl(chkShowLines);
                                Layout.AddControl(btnDeleteAttribute);
                            }
                        }
                    }
                }
            }

            var btnAddAttribute = new Button {
                Text = "Add attribute"
            };

            btnAddAttribute.Click += (object sender, EventArgs e) =>
            {
                AddAttribute(Plot);
                LoadPlot(Plot, false);
            };
            Layout.AddControl(btnAddAttribute);

            using (Layout.BeginRow())
            {
                Layout.AddControl(btnSave);
                Layout.AddControl(btnDelete);
            }

            Layout.ProcessLayout();

            // Shrink attributes panel so it doesn't go off the bottom of the form.
            if (btnSave.Bottom > ClientSize.Height)
            {
                pnlAttributes.Height -= (btnSave.Bottom - ClientSize.Height);
                pnlAttributes.Left   -= 8;
                pnlAttributes.Width  += 16;
                btnAddAttribute.Top   = pnlAttributes.Bottom + 6;
                btnSave.Top           = btnAddAttribute.Bottom + 6;
                btnDelete.Top         = btnAddAttribute.Bottom + 6;
                Apex.ControlUtil.ShowScrollBar(pnlAttributes.Handle, Apex.ControlUtil.ScrollBarDirection.Horizontal, false);
            }
        }
Beispiel #8
0
        private void UpdateLayout()
        {
            if (Loading)
            {
                return;
            }

            Layout.ClearLayout();

            if ((Link.LinkMode)cmbPacketMode.SelectedItem == Link.LinkMode.Bytes)
            {
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblMaxBytes);
                    Layout.AddControl(numMaxBytes);
                }
            }
            else
            {
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblMaxPackets);
                    Layout.AddControl(numMaxPackets);
                }
            }

            if ((Link.QueueType)cmbQueueType.SelectedItem == Link.QueueType.RandomEarlyDiscard)
            {
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblMeanPacketSize);
                    Layout.AddControl(numMeanPacketSize);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblIdlePacketSize);
                    Layout.AddControl(numIdlePacketSize);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(chkGentle);
                    Layout.AddControl(chkWait);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblQW);
                    Layout.AddControl(numQW);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblLinterm);
                    Layout.AddControl(numLinterm);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblLinkBandwidth);
                    Layout.AddControl(txtLinkBandwidth);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblLinkDelay);
                    Layout.AddControl(txtLinkDelay);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblMinTh);
                    Layout.AddControl(numMinTh);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblMaxTh);
                    Layout.AddControl(numMaxTh);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblQueueLimit);
                    Layout.AddControl(numQueueLimit);
                }
            }

            Layout.ProcessLayout();

            btnDelete.Top = pnlMain.Bottom + 6;
            btnSave.Top   = pnlMain.Bottom + 6;
            this.Height   = btnSave.Top + 73;
        }
Beispiel #9
0
        private void UpdateLayout()
        {
            if (Loading)
            {
                return;
            }

            Layout.ClearLayout();

            if ((Stream.StreamType)cmbStreamType.SelectedItem == Stream.StreamType.BulkFTP)
            {
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblMaxBytes);
                    Layout.AddControl(numMaxBytes);
                }
            }
            else if ((Stream.StreamType)cmbStreamType.SelectedItem == Stream.StreamType.UDPPing)
            {
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblMaxPackets);
                    Layout.AddControl(numMaxPackets);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblInterval);
                    Layout.AddControl(txtInterval);
                }
            }
            else if ((Stream.StreamType)cmbStreamType.SelectedItem == Stream.StreamType.OnOff)
            {
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblCBRRate);
                    Layout.AddControl(txtCBRRate);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblOnDistribution);
                    Layout.AddControl(cmbOnDistribution);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblOnInterval);
                    Layout.AddControl(txtOnInterval);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblOffDistribution);
                    Layout.AddControl(cmbOffDistribution);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblOffInterval);
                    Layout.AddControl(txtOffInterval);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblTransportProtocol);
                    Layout.AddControl(cmbTransportProtocol);
                }
            }

            using (Layout.BeginRow())
            {
                Layout.AddControl(lblStartReceiveBufferSize);
                Layout.AddControl(numStartReceiveBufferSize);
            }
            if ((Stream.StreamType)cmbStreamType.SelectedItem == Stream.StreamType.BulkFTP)
            {
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblStartSendBufferSize);
                    Layout.AddControl(numStartSendBufferSize);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblStartMaxWindowSize);
                    Layout.AddControl(numStartMaxWindowSize);
                }
            }

            using (Layout.BeginRow())
            {
                Layout.AddControl(lblEndReceiveBufferSize);
                Layout.AddControl(numEndReceiveBufferSize);
            }
            if ((Stream.StreamType)cmbStreamType.SelectedItem == Stream.StreamType.BulkFTP)
            {
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblEndSendBufferSize);
                    Layout.AddControl(numEndSendBufferSize);
                }
                using (Layout.BeginRow())
                {
                    Layout.AddControl(lblEndMaxWindowSize);
                    Layout.AddControl(numEndMaxWindowSize);
                }
            }

            Layout.ProcessLayout();

            btnSave.Top   = pnlMain.Bottom + 6;
            btnDelete.Top = pnlMain.Bottom + 6;
            this.Height   = btnSave.Top + 73;
        }
Beispiel #10
0
        private void UpdateMainLayout()
        {
            if (Loading)
            {
                // Stop Domain type combo box from updating controls while values are being set.
                return;
            }

            MainLayout.ClearLayout();

            switch ((Domain.DomainType)cmbDomainType.SelectedItem)
            {
            case Domain.DomainType.CSMA:
            {
                using (MainLayout.BeginRow())
                {
                    MainLayout.AddControl(lblBaseAddress);
                    MainLayout.AddControl(txtBaseAddress);
                }
                using (MainLayout.BeginRow())
                {
                    MainLayout.AddControl(lblDataRate);
                    MainLayout.AddControl(txtDataRate);
                }
                using (MainLayout.BeginRow())
                {
                    MainLayout.AddControl(lblDelay);
                    MainLayout.AddControl(txtDelay);
                }
                break;
            }

            case Domain.DomainType.IEEE81211:
            {
                using (MainLayout.BeginRow())
                {
                    MainLayout.AddControl(lblBaseAddress);
                    MainLayout.AddControl(txtBaseAddress);
                }
                using (MainLayout.BeginRow())
                {
                    MainLayout.AddControl(lblWifiStandard);
                    MainLayout.AddControl(cmbWifiStandard);
                }
                using (MainLayout.BeginRow())
                {
                    MainLayout.AddControl(lblWifiMode);
                    MainLayout.AddControl(cmbWifiMode);
                }
                break;
            }

            case Domain.DomainType.LTE:
            {
                using (MainLayout.BeginRow())
                {
                    MainLayout.AddControl(lblBaseAddress);
                    MainLayout.AddControl(txtBaseAddress);
                }
                break;
            }

            case Domain.DomainType.Wimax:
            {
                using (MainLayout.BeginRow())
                {
                    MainLayout.AddControl(lblBaseAddress);
                    MainLayout.AddControl(txtBaseAddress);
                }
                using (MainLayout.BeginRow())
                {
                    MainLayout.AddControl(lblSchedulerType);
                    MainLayout.AddControl(cmbSchedulerType);
                }
                break;
            }
            }

            MainLayout.ProcessLayout();

            UpdateSize();
        }