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

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

Async image thumbail retriving

File size: 11.7 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        WindowState="Maximized"
12        MinHeight="600" MinWidth="800">
13    <Window.Resources>
14        <pwghlp:AdvBooltoVisibilityConverter x:Key="AdvBooltoVisibilityConverter"  Collapse="False" Reverse="False" />
15        <pwghlp:AdvBooltoVisibilityConverter x:Key="AdvBooltoVisibilityConverterReversal"  Collapse="False" Reverse="True" />
16               <!-- DATA TEMPLATES -->
17
18        <DataTemplate DataType="{x:Type pwgdto:PwgImageWPF}">
19            <Border VerticalAlignment="Center" HorizontalAlignment="Center" Padding="4" Margin="2" Background="Blue"
20                    DataContext="{Binding}"><!--Source="{Binding UrlElement}"-->
21                <Image ToolTip="{Binding File}" >
22                    <Image.Source>
23                        <Binding Path="ImgSource" /> <!--Converter="{x:Static pwgsrv:ImageCacheManager.ImageUrlCachedConverter}"-->
24                    </Image.Source>
25                </Image>
26            </Border>
27        </DataTemplate>
28
29        <DataTemplate DataType="{x:Type pwgdto:PwgCategoryWPF}"  >
30            <Border VerticalAlignment="Center" HorizontalAlignment="Center"
31                    Padding="4" Margin="1"
32                    Background="LightBlue"
33                    DataContext="{Binding}">
34                <StackPanel Orientation="Vertical" DataContext="{Binding}" VerticalAlignment="Center" >
35                    <Image Source="pack://application:,,,/Pictures/folder_images.png"
36                           Stretch="Uniform"
37                           MaxHeight="128"
38                           MaxWidth="128">
39                        <Image.ToolTip>
40                            <StackPanel Orientation="Vertical">
41                            <StackPanel Orientation="Horizontal">
42                                <TextBlock Text="{Binding Path=ImagesCount}"/>
43                                <TextBlock Text=" images inside"/>
44                            </StackPanel>
45                                <StackPanel Orientation="Horizontal">
46                                    <TextBlock Text="{Binding Path=SubCategoriesCount}"/>
47                                    <TextBlock Text=" categories inside"/>
48                                </StackPanel>
49                            </StackPanel>
50                        </Image.ToolTip>
51                    </Image>
52                    <TextBlock Text="{Binding Name}" />
53                </StackPanel>
54            </Border>
55        </DataTemplate>
56
57        <Style x:Key="CategoryListStyle" TargetType="{x:Type ListBox}">
58            <Setter Property="Template">
59                <Setter.Value>
60                    <ControlTemplate TargetType="{x:Type ListBox}" >
61                        <Border
62                                                        BorderBrush="Gray"
63                                                        BorderThickness="1"
64                                                        CornerRadius="6"
65                            Background="LightBlue"                           
66                                                         >
67                            <!--Background="{DynamicResource ListBoxGradient}"-->
68                            <ScrollViewer
69                                                                VerticalScrollBarVisibility="Auto"
70                                                                HorizontalScrollBarVisibility="Disabled">
71                                <StackPanel 
72                                                                        IsItemsHost="True"
73                                                                        Orientation="Vertical"
74                                                                        HorizontalAlignment="Center"
75                                    VerticalAlignment="Top"/>
76                            </ScrollViewer>
77                        </Border>
78                    </ControlTemplate>
79                </Setter.Value>
80            </Setter>
81        </Style>
82
83        <Style x:Key="CategoryListItem" TargetType="{x:Type ListBoxItem}">
84            <Setter Property="MaxHeight" Value="128" />
85            <Setter Property="MinHeight" Value="128" />
86            <Setter Property="Opacity" Value=".75" />
87            <Style.Triggers>
88                <EventTrigger RoutedEvent="Mouse.MouseEnter">
89                    <EventTrigger.Actions>
90                        <BeginStoryboard>
91                            <Storyboard>
92                                <DoubleAnimation
93                                                                        Duration="0:0:0.2"
94                                                                        Storyboard.TargetProperty="MaxHeight"
95                                                                        To="220" />
96                                <DoubleAnimation
97                                                                        Duration="0:0:0.2"
98                                                                        Storyboard.TargetProperty="Opacity"
99                                                                        To="1.0" />
100                            </Storyboard>
101                        </BeginStoryboard>
102                    </EventTrigger.Actions>
103                </EventTrigger>
104
105                <EventTrigger RoutedEvent="Mouse.MouseLeave">
106                    <EventTrigger.Actions>
107                        <BeginStoryboard>
108                            <Storyboard>
109                                <DoubleAnimation
110                                                                        Duration="0:0:1"
111                                                                        Storyboard.TargetProperty="MaxHeight" />
112                                <DoubleAnimation
113                                                                        Duration="0:0:0.2"
114                                                                        Storyboard.TargetProperty="Opacity" />
115                            </Storyboard>
116                        </BeginStoryboard>
117                    </EventTrigger.Actions>
118                </EventTrigger>
119            </Style.Triggers>
120        </Style>
121        <!-- PHOTOLIST TEMPLATE -->
122       
123        <Style x:Key="PhotoListStyle" TargetType="{x:Type ListBox}">
124            <Setter Property="Template">
125                <Setter.Value>
126                    <ControlTemplate TargetType="{x:Type ListBox}" >
127                        <Border
128                                                        BorderBrush="Gray"
129                                                        BorderThickness="1"
130                                                        CornerRadius="6"
131                            Background="LightBlue"                           
132                                                         >
133                            <!--Background="{DynamicResource ListBoxGradient}"-->
134                            <ScrollViewer
135                                                                VerticalScrollBarVisibility="Disabled"
136                                                                HorizontalScrollBarVisibility="Auto">
137                                <StackPanel 
138                                                                        IsItemsHost="True"
139                                                                        Orientation="Horizontal"
140                                                                        HorizontalAlignment="Left" />
141                            </ScrollViewer>
142                        </Border>
143                    </ControlTemplate>
144                </Setter.Value>
145            </Setter>
146        </Style>
147
148        <!-- PHOTOLIST STORYBOARDS -->
149
150        <Style x:Key="PhotoListItem" TargetType="{x:Type ListBoxItem}">
151            <Setter Property="MaxHeight" Value="75" />
152            <Setter Property="MinHeight" Value="75" />
153            <Setter Property="Opacity" Value=".75" />
154            <Style.Triggers>
155                <EventTrigger RoutedEvent="Mouse.MouseEnter">
156                    <EventTrigger.Actions>
157                        <BeginStoryboard>
158                            <Storyboard>
159                                <DoubleAnimation
160                                                                        Duration="0:0:0.2"
161                                                                        Storyboard.TargetProperty="MaxHeight"
162                                                                        To="85" />
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
172                <EventTrigger RoutedEvent="Mouse.MouseLeave">
173                    <EventTrigger.Actions>
174                        <BeginStoryboard>
175                            <Storyboard>
176                                <DoubleAnimation
177                                                                        Duration="0:0:1"
178                                                                        Storyboard.TargetProperty="MaxHeight" />
179                                <DoubleAnimation
180                                                                        Duration="0:0:0.2"
181                                                                        Storyboard.TargetProperty="Opacity" />
182                            </Storyboard>
183                        </BeginStoryboard>
184                    </EventTrigger.Actions>
185                </EventTrigger>
186            </Style.Triggers>
187        </Style>
188
189        <!--<Style TargetType="{x:Type pwg:MainWindow}">
190            <Setter Property="Background" Value="{DynamicResource WindowGradient}" />
191        </Style>-->
192
193    </Window.Resources>
194    <DockPanel Name="mainDockPanel"  Margin="5">
195        <StackPanel Name="headerStackPanel" DockPanel.Dock="Top" Orientation="Vertical">
196            <StackPanel Name="headerStackPanelLogo" Orientation="Horizontal" >
197                <Image Name="ImgPiwigoLogo" MinHeight="50" MinWidth="50"
198                   Source="pack://application:,,,/Pictures/PiwigoLogo.png"
199                   ToolTip="www.piwigo.org" Stretch="None" HorizontalAlignment="Left" />
200                <Image Name="ImgGlobe"
201                   Visibility="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=booCmdRunning, Converter={StaticResource AdvBooltoVisibilityConverterReversal}}"
202                   Source="pack://application:,,,/Pictures/Globe.png"
203                   ToolTip="www.piwigo.org" Stretch="None" HorizontalAlignment="Right"/>
204            </StackPanel>
205            <StackPanel Name="connectStackPanel" Orientation="Horizontal" VerticalAlignment="Center"  Margin="5"
206                        DataContext="{Binding Source={StaticResource Session}}">
207                <Label Content="User" Name="LblUsr" />
208                <TextBox Height="23" Name="BbUsr" Width="120" Text="{Binding Path=UserName, Mode=TwoWay}" />
209                <Label Content="Password" Name="LblPwd" />
210                <PasswordBox Height="23" Name="TbPwd" Width="120" PasswordChar="*"
211                             pwgui:PasswordHelper.BindPassword="true" pwgui:PasswordHelper.BoundPassword="{Binding Path=Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
212                <Label Content="Url" Name="LblUrl" />
213                <TextBox Height="23" Name="TbUrl" Width="300" Text="{Binding Path=ServeurName, Mode=TwoWay}"/>
214                <CheckBox Margin="2" VerticalAlignment="Center" IsChecked="{Binding Path=SaveSetting, Mode=TwoWay}">Save settings</CheckBox>
215                <Button Margin="2" Command="{x:Static pwgcmd:PwgCmdProvider.PwgCmdConnect}" Visibility="{Binding Path=IsConnected, Converter={StaticResource AdvBooltoVisibilityConverterReversal}}">Conect</Button>
216                <Button Margin="2" Command="{x:Static pwgcmd:PwgCmdProvider.PwgCmdDisconnect}" Visibility="{Binding Path=IsConnected, Converter={StaticResource AdvBooltoVisibilityConverter}}">Disconect</Button>
217            </StackPanel>
218        </StackPanel>
219        <ListView Name="listViewLogUiInfo"  DockPanel.Dock="Bottom"
220                  DataContext="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=lstMsgInfo}"
221                  ItemsSource="{Binding }" />
222
223        <ListView Name="listViewCategory"  DockPanel.Dock="Left" MinWidth="100"
224                  Style="{DynamicResource CategoryListStyle}"
225                  ItemContainerStyle="{DynamicResource CategoryListItem}"
226                  DataContext="{Binding Source={StaticResource Categories}}"
227                  ItemsSource="{Binding }" MouseDoubleClick="listViewCategory_MouseDoubleClick" />
228       
229        <ListView Name="listViewImage"  DockPanel.Dock="Right"  MinWidth="500"
230                  Style="{DynamicResource PhotoListStyle}"
231                  ItemContainerStyle="{DynamicResource PhotoListItem}"
232                  DataContext="{Binding Source={StaticResource Images}}"
233                  ItemsSource="{Binding }" />
234    </DockPanel>
235   
236</Window>
Note: See TracBrowser for help on using the repository browser.