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

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

New step for piwigowpf

File size: 13.3 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    </Window.Resources>
17    <Grid>
18        <Grid.ColumnDefinitions >
19            <ColumnDefinition Width="*"/>
20            <ColumnDefinition Width="Auto"/>
21            <ColumnDefinition Width="*" MinWidth="600"/>
22        </Grid.ColumnDefinitions>
23        <Grid.RowDefinitions>
24            <RowDefinition Height="Auto" />
25            <RowDefinition Height="*" />
26            <RowDefinition Height="Auto" />
27            <RowDefinition Height="*" />
28            <RowDefinition Height="Auto" />
29        </Grid.RowDefinitions>
30        <StackPanel Name="headerStackPanel"
31            Grid.Column="0"
32            Grid.ColumnSpan="3"
33            Grid.Row="0" 
34            Orientation="Vertical">
35            <StackPanel Name="headerStackPanelLogo" Orientation="Horizontal" >
36                <Image Name="ImgPiwigoLogo" MinHeight="50" MinWidth="50" Margin="5"
37                   Source="pack://application:,,,/Pictures/PiwigoLogo.png"
38                   ToolTip="www.piwigo.org" Stretch="None" HorizontalAlignment="Left" />
39                <Image Name="ImgGlobe" Margin="2"
40                   Visibility="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=booCmdRunning, Converter={StaticResource AdvBooltoVisibilityConverter}}"
41                   Source="pack://application:,,,/Pictures/128x128/Globe.png"
42                   ToolTip="www.piwigo.org" Stretch="None" HorizontalAlignment="Right"/>
43                <UniformGrid  Name="SessInfo" Margin="10" DataContext="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=Session}" Columns="2" Rows="5">
44                    <Label Content="Status"/>
45                    <Label Content="{Binding Path=Status}"/>
46                    <Label Content="Template"/>
47                    <Label Content="{Binding Path=Template}"/>
48                    <Label Content="Theme"/>
49                    <Label Content="{Binding Path=Theme}"/>
50                    <Label Content="Language"/>
51                    <Label Content="{Binding Path=Language}"/>
52                    <Label Content="CharSet"/>
53                    <Label Content="{Binding Path=CharSet}"/>
54                </UniformGrid>
55            </StackPanel>
56            <StackPanel Name="connectStackPanel" Orientation="Horizontal" VerticalAlignment="Center"  Margin="5"
57                        DataContext="{Binding Source={StaticResource Session}}">
58                <Label Content="User" Name="LblUsr" />
59                <TextBox Height="23" Name="BbUsr" Width="120" Text="{Binding Path=UserName, Mode=TwoWay}" />
60                <Label Content="Password" Name="LblPwd" />
61                <PasswordBox Height="23" Name="TbPwd" Width="120" PasswordChar="*"
62                             pwgui:PasswordHelper.BindPassword="true" pwgui:PasswordHelper.BoundPassword="{Binding Path=Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
63                <Label Content="Url" Name="LblUrl" />
64                <TextBox Height="23" Name="TbUrl" Width="300" Text="{Binding Path=ServeurName, Mode=TwoWay}"/>
65                <CheckBox Margin="2" VerticalAlignment="Center" IsChecked="{Binding Path=SaveSetting, Mode=TwoWay}">Save settings</CheckBox>
66                <Button Margin="2" Command="{x:Static pwgcmd:PwgCmdProvider.PwgCmdConnect}" Visibility="{Binding Path=IsConnected, Converter={StaticResource AdvBooltoVisibilityConverterReversal}}">Connect</Button>
67                <Button Margin="2" Command="{x:Static pwgcmd:PwgCmdProvider.PwgCmdDisconnect}" Visibility="{Binding Path=IsConnected, Converter={StaticResource AdvBooltoVisibilityConverter}}">Disconnect</Button>
68            </StackPanel>
69        </StackPanel>
70        <TreeView Name="listViewCategory" 
71                Grid.Column="0"
72                Grid.Row="1" 
73                Grid.RowSpan="3"
74                MinWidth="100"
75                DataContext="{Binding Source={StaticResource Categories}}"
76                ItemsSource="{Binding }" MouseDoubleClick="listViewCategory_MouseDoubleClick">
77            <TreeView.ItemContainerStyle>
78                <!--
79    This Style binds a TreeViewItem to a TreeViewItemViewModel.
80    -->
81                <Style TargetType="{x:Type TreeViewItem}">
82                    <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
83                    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
84                    <Setter Property="FontWeight" Value="Normal" />
85                    <Setter Property="Opacity" Value=".75" />
86                    <Style.Triggers>
87                        <EventTrigger RoutedEvent="Mouse.MouseEnter">
88                            <EventTrigger.Actions>
89                                <BeginStoryboard>
90                                    <Storyboard>
91                                        <DoubleAnimation
92                                                                            Duration="0:0:0.2"
93                                                                            Storyboard.TargetProperty="Opacity"
94                                                                            To="1.0" />
95                                    </Storyboard>
96                                </BeginStoryboard>
97                            </EventTrigger.Actions>
98                        </EventTrigger>
99                        <EventTrigger RoutedEvent="Mouse.MouseLeave">
100                            <EventTrigger.Actions>
101                                <BeginStoryboard>
102                                    <Storyboard>
103                                        <DoubleAnimation
104                                                                            Duration="0:0:0.2"
105                                                                            Storyboard.TargetProperty="Opacity" />
106                                    </Storyboard>
107                                </BeginStoryboard>
108                            </EventTrigger.Actions>
109                        </EventTrigger>
110                        <Trigger Property="IsSelected" Value="True">
111                            <Setter Property="FontWeight" Value="Bold" />
112                        </Trigger>
113                    </Style.Triggers>
114                </Style>
115            </TreeView.ItemContainerStyle>
116            <TreeView.Resources>
117                <HierarchicalDataTemplate
118                DataType="{x:Type pwgdto:PwgCategoryWPF}"
119                ItemsSource="{Binding Children}"
120                >
121                    <StackPanel Orientation="Horizontal" DataContext="{Binding}"
122                        VerticalAlignment="Center" HorizontalAlignment="Center">
123                        <Image Source="pack://application:,,,/Pictures/22x22/folder_images.png" Margin="5"
124                        Stretch="None">
125                            <Image.ToolTip>
126                                <StackPanel Orientation="Vertical">
127                                    <StackPanel Orientation="Horizontal">
128                                        <TextBlock Text="{Binding Path=ImagesCount}"/>
129                                        <TextBlock Text=" images inside"/>
130                                    </StackPanel>
131                                    <StackPanel Orientation="Horizontal">
132                                        <TextBlock Text="{Binding Path=SubCategoriesCount}"/>
133                                        <TextBlock Text=" categories inside"/>
134                                    </StackPanel>
135                                </StackPanel>
136                            </Image.ToolTip>
137                        </Image>
138                        <TextBlock Text="{Binding Name}" />
139                    </StackPanel>
140                </HierarchicalDataTemplate>
141            </TreeView.Resources>
142        </TreeView>
143        <GridSplitter   ResizeDirection="Columns"
144                    Grid.Column="1"
145                    Grid.Row="1" 
146                    Grid.RowSpan="3"
147                    Width="10" Background="Azure" ShowsPreview="True" ResizeBehavior="PreviousAndNext"></GridSplitter>
148        <ListView Name="listViewImage"   
149            Grid.Column="3"
150            Grid.Row="1"   
151            MinWidth="500"
152            DataContext="{Binding Source={StaticResource Images}}"
153            ItemsSource="{Binding }" SelectionMode="Single" IsSynchronizedWithCurrentItem="True" SelectionChanged="listViewImage_SelectionChanged">
154            <ListView.ItemsPanel>
155                <ItemsPanelTemplate>
156                    <UniformGrid/>
157                </ItemsPanelTemplate>
158            </ListView.ItemsPanel>
159            <ListView.ItemContainerStyle>
160                <Style TargetType="{x:Type ListViewItem}">
161                    <Setter Property="FontWeight" Value="Normal" />
162                    <Setter Property="MaxHeight" Value="75" />
163                    <Setter Property="MinHeight" Value="75" />
164                    <Setter Property="Opacity" Value=".75" />
165                    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
166                    <Style.Triggers>
167                        <EventTrigger RoutedEvent="Mouse.MouseEnter">
168                            <EventTrigger.Actions>
169                                <BeginStoryboard>
170                                    <Storyboard>
171                                        <DoubleAnimation
172                                                                        Duration="0:0:0.2"
173                                                                        Storyboard.TargetProperty="Opacity"
174                                                                        To="1.0" />
175                                    </Storyboard>
176                                </BeginStoryboard>
177                            </EventTrigger.Actions>
178                        </EventTrigger>
179                        <EventTrigger RoutedEvent="Mouse.MouseLeave">
180                            <EventTrigger.Actions>
181                                <BeginStoryboard>
182                                    <Storyboard>
183                                        <DoubleAnimation
184                                                                        Duration="0:0:0.2"
185                                                                        Storyboard.TargetProperty="Opacity" />
186                                    </Storyboard>
187                                </BeginStoryboard>
188                            </EventTrigger.Actions>
189                        </EventTrigger>
190                        <Trigger Property="IsSelected" Value="True">
191                            <Setter Property="FontWeight" Value="Bold" />
192                        </Trigger>
193                    </Style.Triggers>
194                </Style>
195            </ListView.ItemContainerStyle>
196            <ListView.Resources>
197                <DataTemplate DataType="{x:Type pwgdto:PwgImageWPF}">
198                    <Border VerticalAlignment="Center" HorizontalAlignment="Center" Padding="4" Margin="2" Background="Blue"
199                    DataContext="{Binding}">
200                        <!--Source="{Binding UrlElement}"-->
201                        <Image ToolTip="{Binding File}" >
202                            <Image.Source>
203                                <Binding Path="ImgSourceThumb" />
204                                <!--Converter="{x:Static pwgsrv:ImageCacheManager.ImageUrlCachedConverter}"-->
205                            </Image.Source>
206                        </Image>
207                    </Border>
208                </DataTemplate>
209            </ListView.Resources>
210        </ListView>
211        <GridSplitter   ResizeDirection="Rows"
212                    Grid.Column="3"
213                    Grid.Row="2" 
214                    Height="3" Background="Azure" ShowsPreview="True" ResizeBehavior="PreviousAndNext"></GridSplitter>
215        <StackPanel Grid.Column="3"
216                    Grid.Row="3"
217                    MinHeight="150" MinWidth="200"  DataContext="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=ImageShown}">
218            <Image ToolTip="{Binding Path=File}" >
219                <Image.Source>
220                    <Binding Path="ImgSource" />
221                </Image.Source>
222            </Image>
223        </StackPanel>
224        <Expander 
225            Grid.Column="0"
226            Grid.ColumnSpan="3"
227            Grid.Row="4"  >
228            <Expander.Header>
229                <Button Height="18" Name="btnDeleteLog" Width="18"
230                        ToolTip="Delete activity trace"
231                        Command="{x:Static pwgcmd:PwgCmdDeleteTrace.Command}">
232                    <Button.Content>
233                        <Image Source="/PiwigoWpf;component/Pictures/16x16/14_layer_deletelayer.png" Stretch="None" />
234                    </Button.Content>
235                </Button>
236            </Expander.Header>
237            <ListView Name="listViewLogUiInfo"
238                DataContext="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=lstMsgInfo}"
239                ItemsSource="{Binding }" />
240        </Expander>
241    </Grid>
242
243</Window>
Note: See TracBrowser for help on using the repository browser.