forked from Dijji/XstReader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
220 lines (220 loc) · 13.7 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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!-- Copyright (c) 2016, Dijji, and released under Ms-PL. This can be found in the root of this distribution.-->
<Window x:Class="XstReader.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Xst Reader" Height="800" Width="1500">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="VisibleIfTrue"/>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="3"/>
<ColumnDefinition Width="7*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<TreeView Grid.Row="0" Name="treeFolders" ItemsSource="{Binding Path=RootFolders}" FontSize="12" SelectedItemChanged="treeFolders_SelectedItemChanged">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=Folders}">
<Grid>
<TextBlock Text="{Binding Path=Description}" />
</Grid>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
<TreeView.ItemContainerStyle>
<Style>
<Setter Property="TreeViewItem.IsExpanded" Value="true"/>
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
<StackPanel Grid.Row="2" Orientation="Horizontal">
<Button Content="Open..." Height="20" HorizontalAlignment="Left" Margin="10,5,0,0" Name="btnOpen" VerticalAlignment="Top" Width="75" Click="btnOpen_Click" />
<TextBlock Name="txtStatus" Margin="20,7,0,0" Width="100" />
</StackPanel>
</Grid>
<GridSplitter Grid.Column="1" Width="3" HorizontalAlignment="Stretch" />
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<ListView Grid.Row="0" Name="listMessages" Margin="0,0,0,0" DataContext="{Binding Path=SelectedFolder}" ItemsSource="{Binding Path=Messages}"
SelectionChanged="listMessages_SelectionChanged" FontSize="12">
<ListView.View>
<GridView>
<GridViewColumn Width="15" >
<GridViewColumn.Header>
<GridViewColumnHeader Tag="HasAttachment" Click="listMessagesColumnHeader_Click">A</GridViewColumnHeader>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<!--use the Unicode paperclip character to mark messages with attachments-->
<TextBlock Text=" 📎" Margin="-8,0,0,0" Visibility="{Binding HasAttachment, Converter={StaticResource VisibleIfTrue}}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="350" >
<GridViewColumn.Header>
<GridViewColumnHeader Tag="Subject" Click="listMessagesColumnHeader_Click">Subject</GridViewColumnHeader>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Subject}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="100" >
<GridViewColumn.Header>
<GridViewColumnHeader Tag="FromTo" Click="listMessagesColumnHeader_Click">From or To</GridViewColumnHeader>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=FromTo}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="120">
<GridViewColumn.Header>
<GridViewColumnHeader Tag="Date" Click="listMessagesColumnHeader_Click">Date</GridViewColumnHeader>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DisplayDate}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</Grid>
<GridSplitter Grid.Column="3" Width="3" HorizontalAlignment="Stretch" />
<Grid Grid.Column="4">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Visibility="{Binding ShowContent, Converter={StaticResource VisibleIfTrue}}">
<TextBox DataContext="{Binding Path=CurrentMessage}" Text="{Binding Path=Body}"
Visibility="{Binding ShowText, Converter={StaticResource VisibleIfTrue}}"/>
<WebBrowser Name="wbMessage" DataContext="{Binding Path=CurrentMessage}"
Visibility="{Binding ShowHtml, Converter={StaticResource VisibleIfTrue}}"/>
<RichTextBox Name="rtfMessage" DataContext="{Binding Path=CurrentMessage}"
Visibility="{Binding ShowRtf, Converter={StaticResource VisibleIfTrue}}"/>
</Grid>
<Grid Grid.Row="0" Visibility="{Binding ShowProperties, Converter={StaticResource VisibleIfTrue}}">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="3"/>
<RowDefinition Height="4*"/>
</Grid.RowDefinitions>
<ListView Grid.Row="0" Name="listRecipients" Margin="0,0,0,0" ItemsSource="{Binding Path=CurrentMessage.Recipients}"
SelectionChanged="listRecipients_SelectionChanged" FontSize="12">
<ListView.View>
<GridView>
<GridViewColumn Width="100" Header="Type" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=RecipientType}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="200" Header="Name" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DisplayName}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="400" Header="Email" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=EmailAddress}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<GridSplitter Grid.Row="1" Height="3" HorizontalAlignment="Stretch" />
<ListView Grid.Row="2" Name="listProperties" Margin="0,0,0,0" ItemsSource="{Binding Path=CurrentProperties}" FontSize="12">
<ListView.View>
<GridView>
<GridViewColumn Width="50" Header="Id" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DisplayId}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="200" Header="Description" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Description}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="400" Header="Value" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DisplayValue}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</Grid>
<ListView Grid.Row="1" Name="listAttachments" Margin="0,0,0,0" ItemsSource="{Binding Path=CurrentMessage.Attachments}" MaxHeight="200"
SelectionChanged="listAttachments_SelectionChanged" FontSize="12" Visibility="{Binding IsAttachmentPresent, Converter={StaticResource VisibleIfTrue}}">
<ListView.View>
<GridView>
<GridViewColumn Width="75" Header="Type" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Type}" FontWeight="{Binding Path=Weight}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="300" Header="Attachment" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Description}" FontWeight="{Binding Path=Weight}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="50" Header="Size" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Size}" FontWeight="{Binding Path=Weight}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<StackPanel Grid.Row="2" Orientation="Horizontal">
<Button Content="Save File..." Height="20" Margin="10,5,0,0" Name="btnSave" VerticalAlignment="Top" Width="75" Click="btnSave_Click"
Visibility="{Binding IsFileAttachmentPresent, Converter={StaticResource VisibleIfTrue}}" IsEnabled="{Binding Path=IsFileAttachmentSelected}"/>
<Button Content="Save All Files..." Height="20" Margin="10,5,0,0" Name="btnSaveAll" VerticalAlignment="Top" Width="90" Click="btnSaveAll_Click"
Visibility="{Binding IsFileAttachmentPresent, Converter={StaticResource VisibleIfTrue}}" IsEnabled="{Binding Path=IsFileAttachmentPresent}"/>
<Button Content="Open Email" Height="20" Margin="10,5,0,0" Name="btnOpenEmail" VerticalAlignment="Top" Width="75" Click="btnOpenEmail_Click"
Visibility="{Binding IsEmailAttachmentPresent, Converter={StaticResource VisibleIfTrue}}" IsEnabled="{Binding Path=IsEmailAttachmentSelected}"/>
<Button Content="Close Email" Height="20" Margin="10,5,0,0" Name="btnCloseEmail" VerticalAlignment="Top" Width="75" Click="btnCloseEmail_Click"
Visibility="{Binding CanPopMessage, Converter={StaticResource VisibleIfTrue}}" />
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
<RadioButton x:Name="rbContent" Content="Content" Margin="0,10,10,0" IsChecked="True" Click="rbContent_Click"
Visibility="{Binding MessagePresent, Converter={StaticResource VisibleIfTrue}}"/>
<RadioButton x:Name="rbProperties" Content="Properties" Margin="0,10,10,0" Click="rbProperties_Click"
Visibility="{Binding MessagePresent, Converter={StaticResource VisibleIfTrue}}"/>
</StackPanel>
</Grid>
</Grid>
</Window>