From 67dab7288ccadaf254b064e6f8172b6c8274a0af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Thu, 8 Nov 2018 21:11:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=20=D1=87=D0=B5=D1=80=D0=BD=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D0=B9=20=D0=B2=D0=B0=D1=80=D0=B8=D0=B0=D0=BD=D1=82=20=D1=80?= =?UTF-8?q?=D0=B5=D0=BD=D0=B4=D0=B5=D1=80=D0=B0=20=D1=81=D0=B8=D0=B3=D0=BD?= =?UTF-8?q?=D0=B0=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Signal Generator/MainWindow.xaml.cs | 9 ++++- Signal Generator/Signal/FmSignal.cs | 2 +- Signal Generator/Signal/MultiSignal.cs | 6 ++-- Signal Generator/Signal/SinusoidalSignal.cs | 2 +- Signal Generator/TaskWindow.xaml | 6 ++-- Signal Generator/TaskWindow.xaml.cs | 40 ++++++++++++++++++++- 6 files changed, 55 insertions(+), 10 deletions(-) diff --git a/Signal Generator/MainWindow.xaml.cs b/Signal Generator/MainWindow.xaml.cs index 5477699..88e4a84 100644 --- a/Signal Generator/MainWindow.xaml.cs +++ b/Signal Generator/MainWindow.xaml.cs @@ -22,7 +22,7 @@ namespace Signal_Generator public partial class MainWindow : Window { AddSignalWindow addSignalWindow_Instance; - TaskWindow taskWindow_Instance = new TaskWindow(); + TaskWindow taskWindow_Instance; ObservableCollection signalCollection; public MainWindow() @@ -52,11 +52,18 @@ namespace Signal_Generator private void startProcedure_Button_Click(object sender, RoutedEventArgs e) { + MultiSignal ms = new MultiSignal(); + foreach (IAnalogSignal item in signalCollection) + { + ms.add(item); + } + taskWindow_Instance = new TaskWindow(ms); taskWindow_Instance.Show(); } private void removeSignal_Button_Click(object sender, RoutedEventArgs e) { + if (signals_ListBox.SelectedIndex == -1) return; signalCollection.RemoveAt(signals_ListBox.SelectedIndex); } } diff --git a/Signal Generator/Signal/FmSignal.cs b/Signal Generator/Signal/FmSignal.cs index de3265a..74e4611 100644 --- a/Signal Generator/Signal/FmSignal.cs +++ b/Signal Generator/Signal/FmSignal.cs @@ -32,7 +32,7 @@ namespace Signal_Generator public double currentAmplitude(double t) { var c = paramsCollection.ToArray(); - return c[0].value * Math.Sin(2 * Math.PI * c[1].value* t + c[2].value * Math.Sin(t)); + return c[0].value * Math.Sin(2 * 3.14 * c[1].value* t + c[2].value * Math.Sin(t)); } } } diff --git a/Signal Generator/Signal/MultiSignal.cs b/Signal Generator/Signal/MultiSignal.cs index 85ff49f..03c826b 100644 --- a/Signal Generator/Signal/MultiSignal.cs +++ b/Signal Generator/Signal/MultiSignal.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Signal_Generator { - class MultiSignal : IAnalogSignal + public class MultiSignal : IAnalogSignal { private List signals { get; set; } @@ -16,12 +16,12 @@ namespace Signal_Generator signals = new List(); } - public void add(IAnalogSignal signal) + internal void add(IAnalogSignal signal) { signals.Add(signal); } - public void remove(IAnalogSignal signal) + internal void remove(IAnalogSignal signal) { signals.Remove(signal); } diff --git a/Signal Generator/Signal/SinusoidalSignal.cs b/Signal Generator/Signal/SinusoidalSignal.cs index 992bfd4..2ac6047 100644 --- a/Signal Generator/Signal/SinusoidalSignal.cs +++ b/Signal Generator/Signal/SinusoidalSignal.cs @@ -32,7 +32,7 @@ namespace Signal_Generator public double currentAmplitude(double t) { var c = paramsCollection.ToArray(); - return c[0].value * Math.Sin(2 * Math.PI * c[1].value * t + c[2].value); + return c[0].value * Math.Sin(2.0 * 3.14 * c[1].value * t + c[2].value); } } } diff --git a/Signal Generator/TaskWindow.xaml b/Signal Generator/TaskWindow.xaml index bd51cf1..dc0a050 100644 --- a/Signal Generator/TaskWindow.xaml +++ b/Signal Generator/TaskWindow.xaml @@ -20,13 +20,13 @@ - - + + Время выполения: Текущий сигнал: -