Ejemplo n.º 1
0
        private Panel GetSignalFrame(SignalManager manager, SinGenerator signal, int i)
        {
            var frame = new Panel
            {
                BorderStyle = BorderStyle.FixedSingle,
                Height      = frameHeight,
                Width       = Width - 20
            };

            var delButton = new Button
            {
                Dock = DockStyle.Bottom,
                Text = "Удалить"
            };

            delButton.Click += (sender, ev) =>
            {
                new SignalDeleteConfirm(manager, signal).ShowDialog();
            };

            var formula = new Label
            {
                Dock = DockStyle.Top,
                Text = manager.Signals[i].GetTextFormula(),
                Font = new Font("Arial", 10)
            };

            frame.Controls.Add(formula);
            frame.Controls.Add(delButton);
            Controls.Add(frame);

            return(frame);
        }
Ejemplo n.º 2
0
        public SignalDeleteConfirm(SignalManager manager, SinGenerator signal)
        {
            MaximumSize = new Size(400, 300);
            MinimumSize = new Size(400, 300);

            var message = new Label
            {
                Width    = 250,
                Text     = "Вы уверены что хотите удалить сигнал " + signal.GetTextFormula() + " из списка сигналов.",
                Location = new Point(50, 100)
            };

            var okButton = new Button
            {
                Location = new Point(100, 150),
                Text     = "Да"
            };

            okButton.Click += (sender, ev) => {
                manager.DeleteSignal(signal);
                Close();
            };

            var cancelButton = new Button()
            {
                Location = new Point(200, 150),
                Text     = "Нет"
            };

            cancelButton.Click += (sender, ev) => { Close(); };

            Controls.Add(message);
            Controls.Add(okButton);
            Controls.Add(cancelButton);
        }
Ejemplo n.º 3
0
        public void DeleteSignal(SinGenerator signal)
        {
            var i = Signals.IndexOf(signal);

            if (i >= 0)
            {
                DeleteSignal(i);
            }
        }
Ejemplo n.º 4
0
        public double[] AddSignalBySize(int start, int dur, double offset, double freq, double mult, double constant, double fading)
        {
            var gen    = new SinGenerator(start, dur, offset, freq, mult, constant, fading);
            var signal = gen.GenerateSin();

            for (var i = 0; i < signal.Length; i++)
            {
                Sum[(start + i) % Sum.Length] += signal[i];
            }

            Signals.Add(gen);

            if (AddedSignal != null)
            {
                AddedSignal(gen, Signals.Count - 1);
            }

            return(signal);
        }