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

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

root category handled

File size: 18.6 KB
RevLine 
[7150]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"
[11911]5        xmlns:pwgui="clr-namespace:Com.Piwigo.Wpf.UI"
[7160]6        xmlns:pwgdto="clr-namespace:Com.Piwigo.Wpf.DTO"
[7150]7        xmlns:pwgcmd="clr-namespace:Com.Piwigo.Wpf.Command"
[11904]8        xmlns:pwgsrv="clr-namespace:Com.Piwigo.Wpf.Service"
[11922]9        xmlns:pwghlp="clr-namespace:Com.Piwigo.Wpf.Helper"
[7150]10        Title="PiwigoWpf"
[11935]11        Name="_this"
[7150]12        WindowState="Maximized"
[11935]13        MinHeight="600" MinWidth="800" Background="AliceBlue">
[7150]14    <Window.Resources>
[11922]15        <pwghlp:AdvBooltoVisibilityConverter x:Key="AdvBooltoVisibilityConverter"  Collapse="False" Reverse="False" />
16        <pwghlp:AdvBooltoVisibilityConverter x:Key="AdvBooltoVisibilityConverterReversal"  Collapse="False" Reverse="True" />
[11935]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>
[7150]84    </Window.Resources>
[11926]85    <Grid>
86        <Grid.ColumnDefinitions >
87            <ColumnDefinition Width="Auto"/>
[11935]88            <ColumnDefinition Width="Auto"/>
[11926]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">
[11922]101            <StackPanel Name="headerStackPanelLogo" Orientation="Horizontal" >
[11926]102                <Image Name="ImgPiwigoLogo" MinHeight="50" MinWidth="50" Margin="5"
[7150]103                   Source="pack://application:,,,/Pictures/PiwigoLogo.png"
[11904]104                   ToolTip="www.piwigo.org" Stretch="None" HorizontalAlignment="Left" />
[11935]105                <Grid Name="OverLay" Visibility="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=booCmdRunning, Converter={StaticResource AdvBooltoVisibilityConverter}}">
106                <Image Name="ImgGlobe" Margin="2"                   
[11926]107                   Source="pack://application:,,,/Pictures/128x128/Globe.png"
[11935]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>
[11926]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>
[11922]125            </StackPanel>
[7150]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" />
[11911]131                <PasswordBox Height="23" Name="TbPwd" Width="120" PasswordChar="*"
132                             pwgui:PasswordHelper.BindPassword="true" pwgui:PasswordHelper.BoundPassword="{Binding Path=Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
[7150]133                <Label Content="Url" Name="LblUrl" />
134                <TextBox Height="23" Name="TbUrl" Width="300" Text="{Binding Path=ServeurName, Mode=TwoWay}"/>
[11911]135                <CheckBox Margin="2" VerticalAlignment="Center" IsChecked="{Binding Path=SaveSetting, Mode=TwoWay}">Save settings</CheckBox>
[11926]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>
[7150]138            </StackPanel>
139        </StackPanel>
[11935]140        <TreeView Name="listViewCategory"  Background="{Binding ElementName=this}"
[11926]141                Grid.Column="0"
142                Grid.Row="1" 
[11935]143                MinWidth="180"
[11926]144                DataContext="{Binding Source={StaticResource Categories}}"
[11935]145                ItemsSource="{Binding}"  MouseDoubleClick="listViewCategory_MouseDoubleClick"
146                HorizontalAlignment="Left" PreviewMouseDown="listViewCategory_PreviewMouseDown">
[11926]147            <TreeView.ItemContainerStyle>
148                <!--
149    This Style binds a TreeViewItem to a TreeViewItemViewModel.
150    -->
151                <Style TargetType="{x:Type TreeViewItem}">
152                    <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
153                    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
154                    <Setter Property="FontWeight" Value="Normal" />
155                    <Setter Property="Opacity" Value=".75" />
156                    <Style.Triggers>
157                        <EventTrigger RoutedEvent="Mouse.MouseEnter">
158                            <EventTrigger.Actions>
159                                <BeginStoryboard>
160                                    <Storyboard>
161                                        <DoubleAnimation
162                                                                            Duration="0:0:0.2"
163                                                                            Storyboard.TargetProperty="Opacity"
164                                                                            To="1.0" />
165                                    </Storyboard>
166                                </BeginStoryboard>
167                            </EventTrigger.Actions>
168                        </EventTrigger>
169                        <EventTrigger RoutedEvent="Mouse.MouseLeave">
170                            <EventTrigger.Actions>
171                                <BeginStoryboard>
172                                    <Storyboard>
173                                        <DoubleAnimation
174                                                                            Duration="0:0:0.2"
175                                                                            Storyboard.TargetProperty="Opacity" />
176                                    </Storyboard>
177                                </BeginStoryboard>
178                            </EventTrigger.Actions>
179                        </EventTrigger>
180                        <Trigger Property="IsSelected" Value="True">
181                            <Setter Property="FontWeight" Value="Bold" />
182                        </Trigger>
183                    </Style.Triggers>
184                </Style>
185            </TreeView.ItemContainerStyle>
186            <TreeView.Resources>
187                <HierarchicalDataTemplate
[11935]188                DataType="{x:Type pwgdto:PwgTreeCategoryWPF}"
189                ItemsSource="{Binding Childrens}"
190                >
191                    <StackPanel Orientation="Horizontal" DataContext="{Binding}"
192                        VerticalAlignment="Center" HorizontalAlignment="Center">
193                        <Image Source="pack://application:,,,/Pictures/22x22/folder_html.png" Margin="5"
194                        Stretch="None">
195                        </Image>
196                        <TextBlock Text="{Binding Name}" />
197                    </StackPanel>
198                </HierarchicalDataTemplate>
199                <HierarchicalDataTemplate
[11926]200                DataType="{x:Type pwgdto:PwgCategoryWPF}"
[11935]201                ItemsSource="{Binding Childrens}"
[11926]202                >
203                    <StackPanel Orientation="Horizontal" DataContext="{Binding}"
204                        VerticalAlignment="Center" HorizontalAlignment="Center">
205                        <Image Source="pack://application:,,,/Pictures/22x22/folder_images.png" Margin="5"
206                        Stretch="None">
207                        </Image>
208                        <TextBlock Text="{Binding Name}" />
[11935]209                        <StackPanel.ToolTip>
210                            <UniformGrid>
211                                    <TextBlock Text="{Binding Path=ImagesCount}"/>
212                                    <TextBlock Text=" images inside"/>
213                                    <TextBlock Text="{Binding Path=SubCategoriesCount}"/>
214                                    <TextBlock Text=" categories inside"/>
215                            </UniformGrid>
216                        </StackPanel.ToolTip>
[11926]217                    </StackPanel>
218                </HierarchicalDataTemplate>
219            </TreeView.Resources>
220        </TreeView>
[11935]221        <GridSplitter ResizeDirection="Columns"
[11926]222                    Grid.Column="1"
223                    Grid.Row="1" 
[11935]224                    Width="5" Height="Auto"></GridSplitter>
225        <Grid Name="CatgeoryContent"
226                    Grid.Column="2"
227                    Grid.Row="1"  >
228            <Grid.ColumnDefinitions >
229                <ColumnDefinition Width="*"/>
230            </Grid.ColumnDefinitions>
231            <Grid.RowDefinitions>
232                <RowDefinition Height="*" />
233                <RowDefinition Height="Auto"/>
234                <RowDefinition Height="*" />
235            </Grid.RowDefinitions>
236            <ListView Name="listViewImage" Background="{Binding ElementName=this}"
237            Grid.Column="0"
238            Grid.Row="0"   
[11926]239            MinWidth="500"
240            DataContext="{Binding Source={StaticResource Images}}"
241            ItemsSource="{Binding }" SelectionMode="Single" IsSynchronizedWithCurrentItem="True" SelectionChanged="listViewImage_SelectionChanged">
[11935]242                <ListView.ItemsPanel>
243                    <ItemsPanelTemplate>
244                        <UniformGrid/>
245                    </ItemsPanelTemplate>
246                </ListView.ItemsPanel>
247                <ListView.ItemContainerStyle>
248                    <Style TargetType="{x:Type ListViewItem}">
249                        <Setter Property="FontWeight" Value="Normal" />
250                        <Setter Property="MaxHeight" Value="75" />
251                        <Setter Property="MinHeight" Value="75" />
252                        <Setter Property="Opacity" Value=".75" />
253                        <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
254                        <Style.Triggers>
255                            <EventTrigger RoutedEvent="Mouse.MouseEnter">
256                                <EventTrigger.Actions>
257                                    <BeginStoryboard>
258                                        <Storyboard>
259                                            <DoubleAnimation
[11926]260                                                                        Duration="0:0:0.2"
261                                                                        Storyboard.TargetProperty="Opacity"
262                                                                        To="1.0" />
[11935]263                                        </Storyboard>
264                                    </BeginStoryboard>
265                                </EventTrigger.Actions>
266                            </EventTrigger>
267                            <EventTrigger RoutedEvent="Mouse.MouseLeave">
268                                <EventTrigger.Actions>
269                                    <BeginStoryboard>
270                                        <Storyboard>
271                                            <DoubleAnimation
[11926]272                                                                        Duration="0:0:0.2"
273                                                                        Storyboard.TargetProperty="Opacity" />
[11935]274                                        </Storyboard>
275                                    </BeginStoryboard>
276                                </EventTrigger.Actions>
277                            </EventTrigger>
278                            <Trigger Property="IsSelected" Value="True">
279                                <Setter Property="FontWeight" Value="Bold" />
280                            </Trigger>
281                        </Style.Triggers>
282                    </Style>
283                </ListView.ItemContainerStyle>
284                <ListView.Resources>
285                    <DataTemplate DataType="{x:Type pwgdto:PwgImageWPF}">
286                        <Border VerticalAlignment="Center" HorizontalAlignment="Center" Padding="4" Margin="2" Background="Blue"
[11926]287                    DataContext="{Binding}">
[11935]288                            <!--Source="{Binding UrlElement}"-->
289                            <Image ToolTip="{Binding File}" >
290                                <Image.Source>
291                                    <Binding Path="ImgSourceThumb" />
292                                    <!--Converter="{x:Static pwgsrv:ImageCacheManager.ImageUrlCachedConverter}"-->
293                                </Image.Source>
294                            </Image>
295                        </Border>
296                    </DataTemplate>
297                </ListView.Resources>
298            </ListView>
299            <GridSplitter ResizeDirection="Rows"
300                    Grid.Column="0"
301                    Grid.Row="1" 
302                    Width="Auto"
303                    Height="5"
304            ></GridSplitter>
305            <DockPanel Grid.Column="0"
306                    Grid.Row="2"
307                    DataContext="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=ImageShown}"
308                    >
309                <Image ToolTip="{Binding Path=File}" MaxHeight="360" MaxWidth="480" MinHeight="120" MinWidth="160">
310                    <Image.Source>
311                        <Binding Path="ImgSource" />
312                    </Image.Source>
313                </Image>
314            </DockPanel>
315        </Grid>
[11926]316        <Expander 
317            Grid.Column="0"
318            Grid.ColumnSpan="3"
[11935]319            Grid.Row="3"  >
[11926]320            <Expander.Header>
321                <Button Height="18" Name="btnDeleteLog" Width="18"
322                        ToolTip="Delete activity trace"
323                        Command="{x:Static pwgcmd:PwgCmdDeleteTrace.Command}">
324                    <Button.Content>
325                        <Image Source="/PiwigoWpf;component/Pictures/16x16/14_layer_deletelayer.png" Stretch="None" />
326                    </Button.Content>
327                </Button>
328            </Expander.Header>
329            <ListView Name="listViewLogUiInfo"
330                DataContext="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=lstMsgInfo}"
331                ItemsSource="{Binding }" />
332        </Expander>
333    </Grid>
[7160]334
[7150]335</Window>
Note: See TracBrowser for help on using the repository browser.