Никита
6 years ago
14 changed files with 317 additions and 2 deletions
@ -0,0 +1,12 @@ |
|||||
|
<Window x:Class="Signal_Generator.AddSignalWindow" |
||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||
|
xmlns:local="clr-namespace:Signal_Generator" |
||||
|
mc:Ignorable="d" |
||||
|
Title="AddSignalWindow" Height="200" Width="400"> |
||||
|
<Grid> |
||||
|
|
||||
|
</Grid> |
||||
|
</Window> |
@ -0,0 +1,27 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Windows; |
||||
|
using System.Windows.Controls; |
||||
|
using System.Windows.Data; |
||||
|
using System.Windows.Documents; |
||||
|
using System.Windows.Input; |
||||
|
using System.Windows.Media; |
||||
|
using System.Windows.Media.Imaging; |
||||
|
using System.Windows.Shapes; |
||||
|
|
||||
|
namespace Signal_Generator |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Логика взаимодействия для AddSignalWindow.xaml
|
||||
|
/// </summary>
|
||||
|
public partial class AddSignalWindow : Window |
||||
|
{ |
||||
|
public AddSignalWindow() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -1,5 +1,7 @@ |
|||||
<?xml version="1.0" encoding="utf-8" ?> |
<?xml version="1.0" encoding="utf-8" ?> |
||||
<configuration> |
<configuration> |
||||
|
<configSections> |
||||
|
</configSections> |
||||
<startup> |
<startup> |
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> |
||||
</startup> |
</startup> |
||||
|
@ -0,0 +1,42 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Signal_Generator |
||||
|
{ |
||||
|
class FmSignal : IAnalogSignal |
||||
|
{ |
||||
|
private double ampl = 0; |
||||
|
private double freq = 0; |
||||
|
private IAnalogSignal modSignal; |
||||
|
|
||||
|
public string ParamsToString |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return this.ToString() + |
||||
|
" | А = " + ampl + |
||||
|
" | f = " + freq; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public override string ToString() |
||||
|
{ |
||||
|
return "FM signal"; |
||||
|
} |
||||
|
|
||||
|
public FmSignal(double ampl, double freq, IAnalogSignal modSignal) |
||||
|
{ |
||||
|
this.ampl = ampl; |
||||
|
this.freq = freq; |
||||
|
this.modSignal = modSignal; |
||||
|
} |
||||
|
|
||||
|
public double currentAmplitude(double t) |
||||
|
{ |
||||
|
return ampl * Math.Sin(2 * Math.PI * freq * t + modSignal.currentAmplitude(t)); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Signal_Generator |
||||
|
{ |
||||
|
interface IAnalogSignal |
||||
|
{ |
||||
|
string ParamsToString { get; } |
||||
|
double currentAmplitude(double t); |
||||
|
} |
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Signal_Generator |
||||
|
{ |
||||
|
class MultiSignal : IAnalogSignal |
||||
|
{ |
||||
|
private List<IAnalogSignal> signals { get; set; } |
||||
|
public string ParamsToString { get; set; } |
||||
|
|
||||
|
public MultiSignal() |
||||
|
{ |
||||
|
signals = new List<IAnalogSignal>(); |
||||
|
} |
||||
|
|
||||
|
public void add(IAnalogSignal signal) |
||||
|
{ |
||||
|
signals.Add(signal); |
||||
|
} |
||||
|
|
||||
|
public void remove(IAnalogSignal signal) |
||||
|
{ |
||||
|
signals.Remove(signal); |
||||
|
} |
||||
|
|
||||
|
public double currentAmplitude(double t) |
||||
|
{ |
||||
|
double summaryAmplitude = 0; |
||||
|
foreach (IAnalogSignal item in signals) |
||||
|
{ |
||||
|
summaryAmplitude += item.currentAmplitude(t); |
||||
|
} |
||||
|
return summaryAmplitude; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
namespace Signal_Generator.Properties { |
||||
|
|
||||
|
|
||||
|
// Этот класс позволяет обрабатывать определенные события в классе параметров:
|
||||
|
// Событие SettingChanging возникает перед изменением значения параметра.
|
||||
|
// Событие PropertyChanged возникает после изменения значения параметра.
|
||||
|
// Событие SettingsLoaded возникает после загрузки значений параметров.
|
||||
|
// Событие SettingsSaving возникает перед сохранением значений параметров.
|
||||
|
internal sealed partial class Settings { |
||||
|
|
||||
|
public Settings() { |
||||
|
// // Для добавления обработчиков событий для сохранения и изменения параметров раскомментируйте приведенные ниже строки:
|
||||
|
//
|
||||
|
// this.SettingChanging += this.SettingChangingEventHandler;
|
||||
|
//
|
||||
|
// this.SettingsSaving += this.SettingsSavingEventHandler;
|
||||
|
//
|
||||
|
} |
||||
|
|
||||
|
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { |
||||
|
// Добавьте здесь код для обработки события SettingChangingEvent.
|
||||
|
} |
||||
|
|
||||
|
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { |
||||
|
// Добавьте здесь код для обработки события SettingsSaving.
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Signal_Generator |
||||
|
{ |
||||
|
class SinusoidalSignal : IAnalogSignal |
||||
|
{ |
||||
|
private double ampl = 0; |
||||
|
private double freq = 0; |
||||
|
private double phase = 0; |
||||
|
|
||||
|
public string ParamsToString |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return this.ToString() + |
||||
|
" | A = " + ampl + |
||||
|
" | f = " + freq + |
||||
|
" | phi = " + phase; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public override string ToString() |
||||
|
{ |
||||
|
return "SIN signal"; |
||||
|
} |
||||
|
|
||||
|
public SinusoidalSignal(double ampl, double freq, double phase = 0) |
||||
|
{ |
||||
|
this.ampl = ampl; |
||||
|
this.freq = freq; |
||||
|
this.phase = phase; |
||||
|
} |
||||
|
|
||||
|
public double currentAmplitude(double t) |
||||
|
{ |
||||
|
return ampl * Math.Sin(2 * Math.PI * freq * t + phase); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
<Window x:Class="Signal_Generator.TaskWindow" |
||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||
|
xmlns:local="clr-namespace:Signal_Generator" |
||||
|
mc:Ignorable="d" |
||||
|
Title="TaskWindow" Height="127" Width="284" |
||||
|
ResizeMode="NoResize"> |
||||
|
<Grid> |
||||
|
<DockPanel VerticalAlignment="Top" Margin="10,10,10,0"> |
||||
|
<DockPanel> |
||||
|
<TextBlock x:Name="currentTime_TextBlock" TextWrapping="Wrap" DockPanel.Dock="Top" Height="18"> |
||||
|
Время выполения: |
||||
|
</TextBlock> |
||||
|
<TextBlock x:Name="currentAmplitude_TextBlock" TextWrapping="Wrap"> |
||||
|
Текущий сигнал: |
||||
|
</TextBlock> |
||||
|
</DockPanel> |
||||
|
<TextBox x:Name="currentTime_TextBox" TextWrapping="Wrap" DockPanel.Dock="Top"/> |
||||
|
<TextBox x:Name="currentAmplitude_TextBox" TextWrapping="Wrap" DockPanel.Dock="Top"/> |
||||
|
<DockPanel HorizontalAlignment="Center"> |
||||
|
<Button x:Name="start_Button" Width="60" Content="Старт" Margin="5,0"/> |
||||
|
<Button x:Name="pause_Button" Width="60" Content="Пауза" Margin="5,0"/> |
||||
|
</DockPanel> |
||||
|
</DockPanel> |
||||
|
</Grid> |
||||
|
</Window> |
@ -0,0 +1,27 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Windows; |
||||
|
using System.Windows.Controls; |
||||
|
using System.Windows.Data; |
||||
|
using System.Windows.Documents; |
||||
|
using System.Windows.Input; |
||||
|
using System.Windows.Media; |
||||
|
using System.Windows.Media.Imaging; |
||||
|
using System.Windows.Shapes; |
||||
|
|
||||
|
namespace Signal_Generator |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Логика взаимодействия для TaskWindow.xaml
|
||||
|
/// </summary>
|
||||
|
public partial class TaskWindow : Window |
||||
|
{ |
||||
|
public TaskWindow() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue