source: extensions/PiwigoLib/PiwigoWpf/MainWindow.xaml @ 12015

Last change on this file since 12015 was 12015, checked in by bayral, 13 years ago

retrieve tags list and image for a tag.

File size: 22.9 KB
Line 
1<Window x:Class="Com.Piwigo.Wpf.MainWindow"
2        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4        xmlns:pwg="clr-namespace:Com.Piwigo.Wpf"
5        xmlns:pwgui="clr-namespace:Com.Piwigo.Wpf.UI"
6        xmlns:pwgdto="clr-namespace:Com.Piwigo.Wpf.DTO"
7        xmlns:pwgcmd="clr-namespace:Com.Piwigo.Wpf.Command"
8        xmlns:pwgsrv="clr-namespace:Com.Piwigo.Wpf.Service"
9        xmlns:pwghlp="clr-namespace:Com.Piwigo.Wpf.Helper"
10        Title="PiwigoWpf"
11        Name="_this"
12        WindowState="Maximized"
13        MinHeight="600" MinWidth="800" Background="AliceBlue">
14    <Window.Resources>
15        <pwghlp:AdvBooltoVisibilityConverter x:Key="AdvBooltoVisibilityConverter"  Collapse="False" Reverse="False" />
16        <pwghlp:AdvBooltoVisibilityConverter x:Key="AdvBooltoVisibilityConverterReversal"  Collapse="False" Reverse="True" />
17        <Style TargetType="GridSplitter">
18            <Setter Property="Background"  Value="CadetBlue"/>
19            <Setter Property="Margin"  Value="0"/>
20            <Setter Property="HorizontalAlignment"  Value="Stretch"/>
21            <Setter Property="VerticalAlignment"  Value="Stretch"/>
22            <Setter Property="ShowsPreview"  Value="True" />
23            <Setter Property="ResizeBehavior"  Value="PreviousAndNext"/>
24        </Style>
25        <ControlTemplate x:Key="loadingAnimation">
26            <ControlTemplate.Triggers>
27                <Trigger Property="Visibility" Value="Visible">
28                    <Trigger.EnterActions>
29                        <BeginStoryboard Name="animation">
30                            <Storyboard Storyboard.DesiredFrameRate="25">
31                                <DoubleAnimation From="0" To="359" Duration="0:0:5" RepeatBehavior="Forever"
32                                                 Storyboard.TargetName="angle" Storyboard.TargetProperty="Angle"/>
33                            </Storyboard>
34                        </BeginStoryboard>
35                    </Trigger.EnterActions>
36                    <Trigger.ExitActions>
37                        <StopStoryboard BeginStoryboardName="animation"/>
38                    </Trigger.ExitActions>
39                </Trigger>
40            </ControlTemplate.Triggers>
41            <Image Name="content" Opacity="0.4">
42                <Image.Source>
43                    <DrawingImage>
44                        <DrawingImage.Drawing>
45                            <DrawingGroup>
46                                <GeometryDrawing Brush="Transparent">
47                                    <GeometryDrawing.Geometry>
48                                        <RectangleGeometry Rect="0,0,1,1"/>
49                                    </GeometryDrawing.Geometry>
50                                </GeometryDrawing>
51                                <DrawingGroup>
52                                    <DrawingGroup.Transform>
53                                        <RotateTransform x:Name="angle" Angle="0" CenterX="0.5" CenterY="0.5"/>
54                                    </DrawingGroup.Transform>
55                                    <GeometryDrawing>
56                                        <GeometryDrawing.Pen>
57                                            <Pen Brush="Aquamarine" Thickness="0.08"/>
58                                        </GeometryDrawing.Pen>
59                                        <GeometryDrawing.Geometry>
60                                            <PathGeometry>
61                                                <PathFigure StartPoint="0.9,0.5">
62                                                    <ArcSegment Point="0.5,0.1" RotationAngle="90" SweepDirection="Clockwise" IsLargeArc="True" Size="0.4,0.4"/>
63                                                </PathFigure>
64                                            </PathGeometry>
65                                        </GeometryDrawing.Geometry>
66                                    </GeometryDrawing>
67                                    <GeometryDrawing Brush="Aquamarine">
68                                        <GeometryDrawing.Geometry>
69                                            <PathGeometry>
70                                                <PathFigure StartPoint="0.5,0">
71                                                    <LineSegment Point="0.7,0.1" />
72                                                    <LineSegment Point="0.5,0.2" />
73                                                </PathFigure>
74                                            </PathGeometry>
75                                        </GeometryDrawing.Geometry>
76                                    </GeometryDrawing>
77                                </DrawingGroup>
78                            </DrawingGroup>
79                        </DrawingImage.Drawing>
80                    </DrawingImage>
81                </Image.Source>
82            </Image>
83        </ControlTemplate>
84    </Window.Resources>
85    <Grid>
86        <Grid.ColumnDefinitions >
87            <ColumnDefinition Width="Auto"/>
88            <ColumnDefinition Width="Auto"/>
89            <ColumnDefinition Width="*" MinWidth="600"/>
90        </Grid.ColumnDefinitions>
91        <Grid.RowDefinitions>
92            <RowDefinition Height="Auto" />
93            <RowDefinition Height="*" />
94            <RowDefinition Height="Auto" />
95        </Grid.RowDefinitions>
96        <StackPanel Name="headerStackPanel"
97            Grid.Column="0"
98            Grid.ColumnSpan="3"
99            Grid.Row="0" 
100            Orientation="Vertical">
101            <StackPanel Name="headerStackPanelLogo" Orientation="Horizontal" >
102                <Image Name="ImgPiwigoLogo" MinHeight="50" MinWidth="50" Margin="5"
103                   Source="pack://application:,,,/Pictures/PiwigoLogo.png"
104                   ToolTip="www.piwigo.org" Stretch="None" HorizontalAlignment="Left" />
105                <Grid Name="OverLay" Visibility="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=booCmdRunning, Converter={StaticResource AdvBooltoVisibilityConverter}}">
106                <Image Name="ImgGlobe" Margin="2"                   
107                   Source="pack://application:,,,/Pictures/128x128/Globe.png"
108                   ToolTip="www.piwigo.org" Stretch="None" HorizontalAlignment="Right">
109                </Image>
110                <Control Name="loading" Grid.Column="4" Template="{StaticResource loadingAnimation}"
111                 Width="116" VerticalAlignment="Center" HorizontalAlignment="Center" />
112                </Grid>
113                <UniformGrid  Name="SessInfo" Margin="10" DataContext="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=Session}" Columns="2" Rows="5">
114                    <Label Content="Status"/>
115                    <Label Content="{Binding Path=Status}"/>
116                    <Label Content="Template"/>
117                    <Label Content="{Binding Path=Template}"/>
118                    <Label Content="Theme"/>
119                    <Label Content="{Binding Path=Theme}"/>
120                    <Label Content="Language"/>
121                    <Label Content="{Binding Path=Language}"/>
122                    <Label Content="CharSet"/>
123                    <Label Content="{Binding Path=CharSet}"/>
124                </UniformGrid>
125            </StackPanel>
126            <StackPanel Name="connectStackPanel" Orientation="Horizontal" VerticalAlignment="Center"  Margin="5"
127                        DataContext="{Binding Source={StaticResource Session}}">
128                <Label Content="User" Name="LblUsr" />
129                <TextBox Height="23" Name="BbUsr" Width="120" Text="{Binding Path=UserName, Mode=TwoWay}" />
130                <Label Content="Password" Name="LblPwd" />
131                <PasswordBox Height="23" Name="TbPwd" Width="120" PasswordChar="*"
132                             pwgui:PasswordHelper.BindPassword="true" pwgui:PasswordHelper.BoundPassword="{Binding Path=Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
133                <Label Content="Url" Name="LblUrl" />
134                <TextBox Height="23" Name="TbUrl" Width="300" Text="{Binding Path=ServeurName, Mode=TwoWay}"/>
135                <CheckBox Margin="2" VerticalAlignment="Center" IsChecked="{Binding Path=SaveSetting, Mode=TwoWay}">Save settings</CheckBox>
136                <Button Margin="2" Command="{x:Static pwgcmd:PwgCmdProvider.PwgCmdConnect}" Visibility="{Binding Path=IsConnected, Converter={StaticResource AdvBooltoVisibilityConverterReversal}}">Connect</Button>
137                <Button Margin="2" Command="{x:Static pwgcmd:PwgCmdProvider.PwgCmdDisconnect}" Visibility="{Binding Path=IsConnected, Converter={StaticResource AdvBooltoVisibilityConverter}}">Disconnect</Button>
138            </StackPanel>
139        </StackPanel>
140        <TabControl Background="{Binding ElementName=this}"
141                Grid.Column="0"
142                Grid.Row="1" 
143                MinWidth="180" >
144            <TabItem Header="Categories">
145            <TreeView Name="listViewCategory" 
146                DataContext="{Binding Source={StaticResource Categories}}"
147                ItemsSource="{Binding}"  MouseDoubleClick="listViewCategory_MouseDoubleClick"
148                HorizontalAlignment="Left" PreviewMouseDown="listViewCategory_PreviewMouseDown">
149                <TreeView.ItemContainerStyle>
150                    <!--
151                    This Style binds a TreeViewItem to a TreeViewItemViewModel.
152                    -->
153                    <Style TargetType="{x:Type TreeViewItem}">
154                        <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
155                        <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
156                        <Setter Property="FontWeight" Value="Normal" />
157                        <Setter Property="Opacity" Value=".75" />
158                        <Style.Triggers>
159                            <EventTrigger RoutedEvent="Mouse.MouseEnter">
160                                <EventTrigger.Actions>
161                                    <BeginStoryboard>
162                                        <Storyboard>
163                                            <DoubleAnimation
164                                                                            Duration="0:0:0.2"
165                                                                            Storyboard.TargetProperty="Opacity"
166                                                                            To="1.0" />
167                                        </Storyboard>
168                                    </BeginStoryboard>
169                                </EventTrigger.Actions>
170                            </EventTrigger>
171                            <EventTrigger RoutedEvent="Mouse.MouseLeave">
172                                <EventTrigger.Actions>
173                                    <BeginStoryboard>
174                                        <Storyboard>
175                                            <DoubleAnimation
176                                                                            Duration="0:0:0.2"
177                                                                            Storyboard.TargetProperty="Opacity" />
178                                        </Storyboard>
179                                    </BeginStoryboard>
180                                </EventTrigger.Actions>
181                            </EventTrigger>
182                            <Trigger Property="IsSelected" Value="True">
183                                <Setter Property="FontWeight" Value="Bold" />
184                            </Trigger>
185                        </Style.Triggers>
186                    </Style>
187                </TreeView.ItemContainerStyle>
188                <TreeView.Resources>
189                    <HierarchicalDataTemplate
190                    DataType="{x:Type pwgdto:PwgTreeCategoryWPF}"
191                    ItemsSource="{Binding Childrens}"
192                    >
193                        <StackPanel Orientation="Horizontal" DataContext="{Binding}"
194                        VerticalAlignment="Center" HorizontalAlignment="Center">
195                            <Image Source="pack://application:,,,/Pictures/22x22/folder_html.png" Margin="5"
196                        Stretch="None">
197                            </Image>
198                            <TextBlock Text="{Binding Name}" />
199                        </StackPanel>
200                    </HierarchicalDataTemplate>
201                    <HierarchicalDataTemplate
202                DataType="{x:Type pwgdto:PwgCategoryWPF}"
203                ItemsSource="{Binding Childrens}"
204                >
205                        <StackPanel Orientation="Horizontal" DataContext="{Binding}"
206                        VerticalAlignment="Center" HorizontalAlignment="Center">
207                            <Image Source="pack://application:,,,/Pictures/22x22/folder_images.png" Margin="5"
208                        Stretch="None">
209                            </Image>
210                            <TextBlock Text="{Binding Name}" />
211                            <StackPanel.ToolTip>
212                                <UniformGrid>
213                                    <TextBlock Text="{Binding Path=ImagesCount}"/>
214                                    <TextBlock Text=" images inside"/>
215                                    <TextBlock Text="{Binding Path=SubCategoriesCount}"/>
216                                    <TextBlock Text=" categories inside"/>
217                                </UniformGrid>
218                            </StackPanel.ToolTip>
219                        </StackPanel>
220                    </HierarchicalDataTemplate>
221                </TreeView.Resources>
222            </TreeView>
223            </TabItem>
224            <TabItem Header="Tags">
225                <ListView Name="listViewTag"
226                DataContext="{Binding Source={StaticResource Tags}}"
227                ItemsSource="{Binding }" SelectionMode="Single" IsSynchronizedWithCurrentItem="True" MouseDoubleClick="listViewTag_MouseDoubleClick">
228                    <ListView.ItemContainerStyle>
229                        <Style TargetType="{x:Type ListViewItem}">
230                            <Setter Property="FontWeight" Value="Normal" />
231                            <Setter Property="MaxHeight" Value="75" />
232                            <Setter Property="MinHeight" Value="75" />
233                            <Setter Property="Opacity" Value=".75" />
234                            <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
235                            <Style.Triggers>
236                                <EventTrigger RoutedEvent="Mouse.MouseEnter">
237                                    <EventTrigger.Actions>
238                                        <BeginStoryboard>
239                                            <Storyboard>
240                                                <DoubleAnimation
241                                                                        Duration="0:0:0.2"
242                                                                        Storyboard.TargetProperty="Opacity"
243                                                                        To="1.0" />
244                                            </Storyboard>
245                                        </BeginStoryboard>
246                                    </EventTrigger.Actions>
247                                </EventTrigger>
248                                <EventTrigger RoutedEvent="Mouse.MouseLeave">
249                                    <EventTrigger.Actions>
250                                        <BeginStoryboard>
251                                            <Storyboard>
252                                                <DoubleAnimation
253                                                                        Duration="0:0:0.2"
254                                                                        Storyboard.TargetProperty="Opacity" />
255                                            </Storyboard>
256                                        </BeginStoryboard>
257                                    </EventTrigger.Actions>
258                                </EventTrigger>
259                                <Trigger Property="IsSelected" Value="True">
260                                    <Setter Property="FontWeight" Value="Bold" />
261                                </Trigger>
262                            </Style.Triggers>
263                        </Style>
264                    </ListView.ItemContainerStyle>
265                    <ListView.Resources>
266                        <DataTemplate DataType="{x:Type pwgdto:PwgTagWPF}">
267                            <Border VerticalAlignment="Center" HorizontalAlignment="Center" Padding="4" Margin="2" DataContext="{Binding}">
268                                <StackPanel ToolTip="{Binding Path=UrlTags}" Orientation="Horizontal">
269                                <Label Content="{Binding Path=Name}"/>
270                                    <Separator />
271                                    <Label Content="{Binding Path=Counter}" />
272                                    <Label Content="Pictures" />
273                                </StackPanel>
274                            </Border>
275                        </DataTemplate>
276                    </ListView.Resources>
277                </ListView>
278            </TabItem>
279        </TabControl>
280        <GridSplitter ResizeDirection="Columns"
281                    Grid.Column="1"
282                    Grid.Row="1" 
283                    Width="5" Height="Auto"></GridSplitter>
284        <Grid Name="CatgeoryContent"
285                    Grid.Column="2"
286                    Grid.Row="1"  >
287            <Grid.ColumnDefinitions >
288                <ColumnDefinition Width="*"/>
289            </Grid.ColumnDefinitions>
290            <Grid.RowDefinitions>
291                <RowDefinition Height="*" />
292                <RowDefinition Height="Auto"/>
293                <RowDefinition Height="*" />
294            </Grid.RowDefinitions>
295            <ListView Name="listViewImage" Background="{Binding ElementName=this}"
296            Grid.Column="0"
297            Grid.Row="0"   
298            MinWidth="500"
299            DataContext="{Binding Source={StaticResource Images}}"
300            ItemsSource="{Binding }" SelectionMode="Single" IsSynchronizedWithCurrentItem="True" SelectionChanged="listViewImage_SelectionChanged">
301                <ListView.ItemsPanel>
302                    <ItemsPanelTemplate>
303                        <UniformGrid/>
304                    </ItemsPanelTemplate>
305                </ListView.ItemsPanel>
306                <ListView.ItemContainerStyle>
307                    <Style TargetType="{x:Type ListViewItem}">
308                        <Setter Property="FontWeight" Value="Normal" />
309                        <Setter Property="MaxHeight" Value="75" />
310                        <Setter Property="MinHeight" Value="75" />
311                        <Setter Property="Opacity" Value=".75" />
312                        <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
313                        <Style.Triggers>
314                            <EventTrigger RoutedEvent="Mouse.MouseEnter">
315                                <EventTrigger.Actions>
316                                    <BeginStoryboard>
317                                        <Storyboard>
318                                            <DoubleAnimation
319                                                                        Duration="0:0:0.2"
320                                                                        Storyboard.TargetProperty="Opacity"
321                                                                        To="1.0" />
322                                        </Storyboard>
323                                    </BeginStoryboard>
324                                </EventTrigger.Actions>
325                            </EventTrigger>
326                            <EventTrigger RoutedEvent="Mouse.MouseLeave">
327                                <EventTrigger.Actions>
328                                    <BeginStoryboard>
329                                        <Storyboard>
330                                            <DoubleAnimation
331                                                                        Duration="0:0:0.2"
332                                                                        Storyboard.TargetProperty="Opacity" />
333                                        </Storyboard>
334                                    </BeginStoryboard>
335                                </EventTrigger.Actions>
336                            </EventTrigger>
337                            <Trigger Property="IsSelected" Value="True">
338                                <Setter Property="FontWeight" Value="Bold" />
339                            </Trigger>
340                        </Style.Triggers>
341                    </Style>
342                </ListView.ItemContainerStyle>
343                <ListView.Resources>
344                    <DataTemplate DataType="{x:Type pwgdto:PwgImageWPF}">
345                        <Border VerticalAlignment="Center" HorizontalAlignment="Center" Padding="4" Margin="2" Background="Blue"
346                    DataContext="{Binding}">
347                            <!--Source="{Binding UrlElement}"-->
348                            <Image ToolTip="{Binding File}" >
349                                <Image.Source>
350                                    <Binding Path="ImgSourceThumb" />
351                                    <!--Converter="{x:Static pwgsrv:ImageCacheManager.ImageUrlCachedConverter}"-->
352                                </Image.Source>
353                            </Image>
354                        </Border>
355                    </DataTemplate>
356                </ListView.Resources>
357            </ListView>
358            <GridSplitter ResizeDirection="Rows"
359                    Grid.Column="0"
360                    Grid.Row="1" 
361                    Width="Auto"
362                    Height="5"
363            ></GridSplitter>
364            <DockPanel Grid.Column="0"
365                    Grid.Row="2"
366                    DataContext="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=ImageShown}"
367                    >
368                <TabControl>
369                    <TabItem Header="Image">
370                    <Image ToolTip="{Binding Path=File}" MaxHeight="360" MaxWidth="480" MinHeight="120" MinWidth="160">
371                        <Image.Source>
372                            <Binding Path="ImgSource" />
373                        </Image.Source>
374                    </Image>
375                    </TabItem>
376                    <TabItem Header="Data">
377                        <UniformGrid Columns="2">
378                            <Label Content="Image Name"/>
379                            <Label Content="{Binding Path=File}"/>
380                            <Label Content="Image heigh"/>
381                            <Label Content="{Binding Path=Height}"/>
382                            <Label Content="Image Width"/>
383                            <Label Content="{Binding Path=Width}"/>
384                       </UniformGrid>
385                    </TabItem>
386                </TabControl>
387            </DockPanel>
388        </Grid>
389        <Expander 
390            Grid.Column="0"
391            Grid.ColumnSpan="3"
392            Grid.Row="3"  >
393            <Expander.Header>
394                <Button Height="18" Name="btnDeleteLog" Width="18"
395                        ToolTip="Delete activity trace"
396                        Command="{x:Static pwgcmd:PwgCmdDeleteTrace.Command}">
397                    <Button.Content>
398                        <Image Source="/PiwigoWpf;component/Pictures/16x16/14_layer_deletelayer.png" Stretch="None" />
399                    </Button.Content>
400                </Button>
401            </Expander.Header>
402            <ListView Name="listViewLogUiInfo"
403                DataContext="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=lstMsgInfo}"
404                ItemsSource="{Binding }" />
405        </Expander>
406    </Grid>
407
408</Window>
Note: See TracBrowser for help on using the repository browser.