Browse Source

Сделана новая нормальная верстка на grid'e

master
Никита 6 years ago
parent
commit
1b8dd22f55
  1. 31
      Signal Generator/AddSignalWindow.xaml
  2. 33
      Signal Generator/MainWindow.xaml
  3. 15
      Signal Generator/MainWindow.xaml.cs
  4. 40
      Signal Generator/TaskWindow.xaml

31
Signal Generator/AddSignalWindow.xaml

@ -5,15 +5,26 @@
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>
<DockPanel Margin="10">
<DockPanel DockPanel.Dock="Top">
<TextBlock x:Name="signalType_TextBlock" Margin="0,0,10,0">Тип сигнала:</TextBlock>
<ComboBox x:Name="signalType_ComboBox" HorizontalAlignment="Stretch"/>
</DockPanel>
<DockPanel DockPanel.Dock="Top">
</DockPanel>
</DockPanel>
Title="Добавить новый сигнал" Height="200" Width="400">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="signalType_TextBlock" Margin="0,0,10,5" Grid.Row="0" Grid.Column="0">Тип сигнала:</TextBlock>
<ComboBox x:Name="signalType_ComboBox" Margin="0,0,0,5" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="1"/>
<DataGrid x:Name="signalProps_DataGrid" Margin="0,0,0,5" HorizontalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="2">
<DataGrid.Columns>
<DataGridTextColumn Header="Название" Width="*" IsReadOnly="True"/>
<DataGridTextColumn Header="Параметр" />
</DataGrid.Columns>
</DataGrid>
<Button x:Name="createItem_Button" Height="20" Width="120" Content="Создать элемент" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"/>
</Grid>
</Window>

33
Signal Generator/MainWindow.xaml

@ -5,11 +5,21 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Signal_Generator"
mc:Ignorable="d"
Title="Signal Generator" Height="450" Width="489">
<Grid>
<DockPanel LastChildFill="True" Margin="10,10,10,10">
Title="Генератор сигналов" Height="450" Width="489">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ListBox x:Name="signals_ListBox" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
DockPanel.Dock="Top" ItemsSource="{Binding}" Margin="0,0,0,20">
DockPanel.Dock="Top" ItemsSource="{Binding}" Margin="0,0,0,5" Grid.ColumnSpan="4">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
@ -25,15 +35,10 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
<DockPanel x:Name="buttons_DockPanel" IsEnabled="True" Margin="10,0,10,10" VerticalAlignment="Bottom">
<DockPanel DockPanel.Dock="Left">
<Button x:Name="startProcedure_Button" Width="120" Content="Запустить процедуру" />
</DockPanel>
<DockPanel HorizontalAlignment="Right">
<Button x:Name="addSignal_Button" Width="20" Content="+" Click="addSignal_Button_Click"/>
<Button x:Name="removeSignal_Button" Width="20" Content="-"/>
</DockPanel>
</DockPanel>
<Button x:Name="startProcedure_Button" Content="Запустить процедуру" Click="startProcedure_Button_Click"
Grid.Row="2" Margin="5,0,0,0"/>
<Button x:Name="addSignal_Button" Width="20" Content="+" Margin="0,0,5,0" Click="addSignal_Button_Click" Grid.Row="2"
Grid.Column="2"/>
<Button x:Name="removeSignal_Button" Width="20" Margin="0,0,5,0" Content="-" Grid.Row="2" Grid.Column="3"/>
</Grid>
</Window>

15
Signal Generator/MainWindow.xaml.cs

@ -21,13 +21,21 @@ namespace Signal_Generator
/// </summary>
public partial class MainWindow : Window
{
AddSignalWindow addSignalWindow_Instance = new AddSignalWindow();
TaskWindow taskWindow_Instance = new TaskWindow();
ObservableCollection<IAnalogSignal> s;
public MainWindow()
{
InitializeComponent();
s = new ObservableCollection<IAnalogSignal>();
signals_ListBox.Items.Clear();
signals_ListBox.ItemsSource = s;
addSignalWindow_Instance.Closed += addSignalWindow_Instance_Closed;
}
private void addSignalWindow_Instance_Closed(object sender, EventArgs e)
{
}
private void addSomeExtra()
@ -40,7 +48,12 @@ namespace Signal_Generator
private void addSignal_Button_Click(object sender, RoutedEventArgs e)
{
addSomeExtra();
addSignalWindow_Instance.Show();
}
private void startProcedure_Button_Click(object sender, RoutedEventArgs e)
{
taskWindow_Instance.Show();
}
}
}

40
Signal Generator/TaskWindow.xaml

@ -5,24 +5,28 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Signal_Generator"
mc:Ignorable="d"
Title="TaskWindow" Height="127" Width="284"
Title="Моделирование работы группы сигналов" Height="250" Width="500"
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 Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Canvas x:Name="signalGraph_Canvas" Grid.ColumnSpan="4" Margin="0,0,0,5"></Canvas>
<TextBlock x:Name="currentTime_TextBlock" Margin="0,0,5,5" Grid.Row="1" Grid.Column="1">Время выполения:</TextBlock>
<TextBox x:Name="currentTime_TextBox" Margin="0,0,0,5" Grid.Row="1" Grid.Column="2"/>
<TextBlock x:Name="currentAmplitude_TextBlock" Margin="0,0,5,5" Grid.Row="2" Grid.Column="1">Текущий сигнал:</TextBlock>
<TextBox x:Name="currentAmplitude_TextBox" Margin="0,0,0,5" Grid.Row="2" Grid.Column="2"/>
<Button x:Name="start_Button" Width="60" Content="Старт" Margin="5,0" Grid.Row="3" Grid.Column="1"/>
<Button x:Name="pause_Button" Width="60" Content="Пауза" Margin="5,0" Grid.Row="3" Grid.Column="2"/>
</Grid>
</Window>

Loading…
Cancel
Save