~ruther/NosTale-PacketLogger

ref: 676e5bb566fd796d9d023b1ccbdc751d8e0bb5c2 NosTale-PacketLogger/src/PacketLogger/Views/DocumentView.axaml -rw-r--r-- 8.1 KiB
676e5bb5 — Rutherther feat: add possibility to save and load settings to json 2 years ago
                                                                                
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<UserControl xmlns="https://github.com/avaloniaui"
             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:PacketLogger.Views"
             xmlns:viewModels="clr-namespace:PacketLogger.ViewModels"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             xmlns:i="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia"
             x:Class="PacketLogger.Views.DocumentView">
    <Design.DataContext>
        <viewModels:DocumentViewModel />
    </Design.DataContext>

    <Grid>
        <Border Grid.Row="1" IsVisible="{Binding !Loaded}"
                MaxWidth="1000" MaxHeight="600"
                CornerRadius="25"
                Background="{DynamicResource SystemControlPageBackgroundChromeLowBrush}">
            <Grid RowDefinitions="Auto,*" Margin="50">
                <Border IsVisible="{Binding HasError}"
                        MaxWidth="600"
                        Margin="10"
                        Grid.Row="0" Background="Red" CornerRadius="10">
                    <StackPanel Margin="10" Orientation="Vertical">
                        <Grid ColumnDefinitions="*,30">
                            <TextBlock Grid.Column="0" FontSize="20" FontStyle="Oblique" Text="Notification" />
                            <Button Padding="0" Margin="0" Command="{Binding ClearError}" Grid.Column="1" Width="20" Height="20">
                                <i:Icon FontSize="12" Value="mdi-close" />
                            </Button>
                        </Grid>
                        <TextBlock Text="{Binding Error}" TextWrapping="Wrap" />
                    </StackPanel>
                </Border>
                
                <Grid Grid.Row="1" ColumnDefinitions="*,*" RowDefinitions="60, 80, 80, *">
                    <Grid.Styles>
                        <Style Selector="Button.open">
                            <Setter Property="FontSize" Value="24"></Setter>
                            <Setter Property="Width" Value="200" />
                            <Setter Property="Height" Value="60" />
                            <Setter Property="Margin" Value="0" />
                        </Style>
                        <Style Selector="Button.open i|Icon">
                            <Setter Property="Margin" Value="0,0,5,0"></Setter>
                        </Style>
                        <Style Selector="Button.open TextBlock">
                            <Setter Property="Margin" Value="5, 0, 0, 0"></Setter>
                        </Style>
                        <Style Selector="Button.open Border">
                            <Setter Property="BorderThickness" Value="1" />
                            <Setter Property="BorderBrush" Value="{DynamicResource TextControlForeground}"></Setter>
                        </Style>
                    </Grid.Styles>

                    <TextBlock Grid.Row="0" Grid.Column="0" Margin="-10,0,0,0" FontSize="34" Text="Packet Logger" />

                    <Button Grid.Row="1" Grid.Column="0"
                            Classes="open"
                            IsEnabled="{Binding !Loading}"
                            Command="{Binding OpenFile}">
                        <StackPanel VerticalAlignment="Center" Orientation="Horizontal">
                            <i:Icon HorizontalAlignment="Left" Value="mdi-file-document-outline" />
                            <Border></Border>
                            <TextBlock HorizontalAlignment="Right" Text="Open File" />
                        </StackPanel>
                    </Button>
                    <Button Grid.Row="2" Grid.Column="0"
                            Classes="open"
                            IsEnabled="{Binding !Loading}"
                            Command="{Binding OpenDummy}">
                        <StackPanel VerticalAlignment="Center" Orientation="Horizontal">
                            <i:Icon HorizontalAlignment="Left" Value="mdi-file-document-plus-outline" />
                            <Border></Border>
                            <TextBlock HorizontalAlignment="Right" Text="Open Empty" />
                        </StackPanel>
                    </Button>

                    <StackPanel Grid.Row="3" Grid.Column="0" Orientation="Vertical">
                        <TextBlock FontSize="30" Margin="0,0,0,5" Text="Connect to NosTale process" />
                        <DataGrid CanUserReorderColumns="True" CanUserResizeColumns="True"
                                  Margin="0,0,30,0" Items="{Binding Processes}">
                            <DataGrid.Columns>
                                <DataGridTextColumn Header="Character" Binding="{Binding CharacterString}" />
                                <DataGridTextColumn Header="Process" Binding="{Binding ProcessString}" />
                                <DataGridTemplateColumn Header="Connect">
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Content="Connect"
                                                    Command="{Binding $parent[UserControl].DataContext.OpenProcess}"
                                                    IsEnabled="{Binding !$parent[UserControl].DataContext.Loading}"
                                                    CommandParameter="{Binding}" />
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn>
                                
                                <DataGridTemplateColumn Header="Pcap">
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Content="Sniff"
                                                    Command="{Binding $parent[UserControl].DataContext.OpenPcap}"
                                                    IsEnabled="{Binding !$parent[UserControl].DataContext.Loading}"
                                                    CommandParameter="{Binding}" />
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </StackPanel>

                    <TextBlock Grid.Row="0" Grid.Column="1" FontSize="34" Margin="-10,0,0,0" Text="Packet Sender" />

                    <StackPanel Grid.Row="1" Grid.Column="1" Grid.RowSpan="3" Orientation="Vertical">
                        <TextBlock FontSize="30" Margin="0,0,0,5" Text="Open a sender for" />
                        <DataGrid Margin="0,0,30,0" Items="{Binding Providers}">
                            <DataGrid.Columns>
                                <DataGridTextColumn Header="Tab" Binding="{Binding Name}" />
                                <DataGridTemplateColumn Header="Open">
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Content="Open"
                                                    Command="{Binding $parent[UserControl].DataContext.OpenSender}"
                                                    IsEnabled="{Binding !$parent[UserControl].DataContext.Loading}"
                                                    CommandParameter="{Binding }" />
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </StackPanel>
                </Grid>
            </Grid>
        </Border>

        <ContentControl IsVisible="{Binding Loaded}" Content="{Binding  NestedViewModel}" />
    </Grid>
</UserControl>
Do not follow this link