-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
99 lines (90 loc) · 4.47 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<Window x:Class="AristaNetworkManager.MainWindow"
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:views="clr-namespace:AristaNetworkManager.Views"
xmlns:local="clr-namespace:AristaNetworkManager"
xmlns:viewmodels="clr-namespace:AristaNetworkManager.ViewModels"
mc:Ignorable="d"
Title="Arista Network Manager" Height="600" Width="1000">
<Window.DataContext>
<viewmodels:MainWindowViewModel/>
</Window.DataContext>
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Left Panel - Switch List -->
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Command="{Binding AddNewSwitchCommand}" Margin="0,0,0,10">
<TextBlock Text="Add New Switch"/>
</Button>
<ListBox Grid.Row="1"
ItemsSource="{Binding Switches}"
SelectedItem="{Binding SelectedSwitch}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="{Binding Model.Hostname}" FontWeight="Bold"/>
<TextBlock Text="{Binding Model.IpAddress}" Foreground="Gray"/>
<TextBlock Text="{Binding Model.Status}" Foreground="DarkGray"/>
</StackPanel>
<Button Grid.Column="1"
Command="{Binding DataContext.RemoveSwitchCommand,
RelativeSource={RelativeSource AncestorType=Window}}"
CommandParameter="{Binding}"
Margin="5,0,0,0">
<TextBlock Text="Remove"/>
</Button>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<!-- Splitter -->
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch"/>
<!-- Middle Panel - Switch Details -->
<views:SwitchDetailsView Grid.Column="2"
DataContext="{Binding SelectedSwitch}"
Visibility="{Binding Converter={StaticResource NullToVisibilityConverter}}"/>
<!-- Splitter -->
<GridSplitter Grid.Column="3" Width="5" HorizontalAlignment="Stretch"/>
<!-- Right Panel - Configuration -->
<Grid Grid.Column="4">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,10">
<Button Command="{Binding SelectedSwitch.FetchConfigurationCommand}" Margin="0,0,10,0">
<TextBlock Text="Refresh Configuration"/>
</Button>
<Button Command="{Binding SelectedSwitch.UpdateConfigurationCommand}"
CommandParameter="{Binding SelectedSwitch.Configuration}"
Margin="0,0,10,0">
<TextBlock Text="Apply Configuration"/>
</Button>
</StackPanel>
<TextBox Grid.Row="1"
Text="{Binding SelectedSwitch.Configuration, UpdateSourceTrigger=PropertyChanged}"
AcceptsReturn="True"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
FontFamily="Consolas"/>
</Grid>
</Grid>
</Window>