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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Signal_Generator" xmlns:local="clr-namespace:Signal_Generator"
mc:Ignorable="d" mc:Ignorable="d"
Title="AddSignalWindow" Height="200" Width="400"> Title="Добавить новый сигнал" Height="200" Width="400">
<Grid> <Grid Margin="10">
<DockPanel Margin="10"> <Grid.RowDefinitions>
<DockPanel DockPanel.Dock="Top"> <RowDefinition Height="Auto"/>
<TextBlock x:Name="signalType_TextBlock" Margin="0,0,10,0">Тип сигнала:</TextBlock> <RowDefinition Height="*"/>
<ComboBox x:Name="signalType_ComboBox" HorizontalAlignment="Stretch"/> <RowDefinition Height="Auto"/>
</DockPanel> </Grid.RowDefinitions>
<DockPanel DockPanel.Dock="Top"> <Grid.ColumnDefinitions>
</DockPanel> <ColumnDefinition Width="Auto"/>
</DockPanel> <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> </Grid>
</Window> </Window>

33
Signal Generator/MainWindow.xaml

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

15
Signal Generator/MainWindow.xaml.cs

@ -21,13 +21,21 @@ namespace Signal_Generator
/// </summary> /// </summary>
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
AddSignalWindow addSignalWindow_Instance = new AddSignalWindow();
TaskWindow taskWindow_Instance = new TaskWindow();
ObservableCollection<IAnalogSignal> s; ObservableCollection<IAnalogSignal> s;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
s = new ObservableCollection<IAnalogSignal>(); s = new ObservableCollection<IAnalogSignal>();
signals_ListBox.Items.Clear(); signals_ListBox.Items.Clear();
signals_ListBox.ItemsSource = s; signals_ListBox.ItemsSource = s;
addSignalWindow_Instance.Closed += addSignalWindow_Instance_Closed;
}
private void addSignalWindow_Instance_Closed(object sender, EventArgs e)
{
} }
private void addSomeExtra() private void addSomeExtra()
@ -40,7 +48,12 @@ namespace Signal_Generator
private void addSignal_Button_Click(object sender, RoutedEventArgs e) 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Signal_Generator" xmlns:local="clr-namespace:Signal_Generator"
mc:Ignorable="d" mc:Ignorable="d"
Title="TaskWindow" Height="127" Width="284" Title="Моделирование работы группы сигналов" Height="250" Width="500"
ResizeMode="NoResize"> ResizeMode="NoResize">
<Grid> <Grid Margin="10">
<DockPanel VerticalAlignment="Top" Margin="10,10,10,0"> <Grid.RowDefinitions>
<DockPanel> <RowDefinition Height="*"/>
<TextBlock x:Name="currentTime_TextBlock" TextWrapping="Wrap" DockPanel.Dock="Top" Height="18"> <RowDefinition Height="Auto"/>
Время выполения: <RowDefinition Height="Auto"/>
</TextBlock> <RowDefinition Height="Auto"/>
<TextBlock x:Name="currentAmplitude_TextBlock" TextWrapping="Wrap"> </Grid.RowDefinitions>
Текущий сигнал: <Grid.ColumnDefinitions>
</TextBlock> <ColumnDefinition Width="*"/>
</DockPanel> <ColumnDefinition Width="Auto"/>
<TextBox x:Name="currentTime_TextBox" TextWrapping="Wrap" DockPanel.Dock="Top"/> <ColumnDefinition Width="*"/>
<TextBox x:Name="currentAmplitude_TextBox" TextWrapping="Wrap" DockPanel.Dock="Top"/> <ColumnDefinition Width="*"/>
<DockPanel HorizontalAlignment="Center"> </Grid.ColumnDefinitions>
<Button x:Name="start_Button" Width="60" Content="Старт" Margin="5,0"/>
<Button x:Name="pause_Button" Width="60" Content="Пауза" Margin="5,0"/> <Canvas x:Name="signalGraph_Canvas" Grid.ColumnSpan="4" Margin="0,0,0,5"></Canvas>
</DockPanel> <TextBlock x:Name="currentTime_TextBlock" Margin="0,0,5,5" Grid.Row="1" Grid.Column="1">Время выполения:</TextBlock>
</DockPanel> <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> </Grid>
</Window> </Window>

Loading…
Cancel
Save