Changeset 11935 for extensions/PiwigoLib
- Timestamp:
- Aug 12, 2011, 4:32:33 PM (13 years ago)
- Location:
- extensions/PiwigoLib
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PiwigoLib/PiwigoLib/Service/PwgCategoriesService.cs
r11850 r11935 42 42 else 43 43 { 44 returnValue = ConvertProxyResponseToDTO(response );44 returnValue = ConvertProxyResponseToDTO(response, CatgeroryId); 45 45 } 46 46 } … … 79 79 else 80 80 { 81 returnValue = ConvertProxyResponseToDTO(response );81 returnValue = ConvertProxyResponseToDTO(response, null); 82 82 } 83 83 } … … 346 346 /// <param name="response"></param> 347 347 /// <param name="session"></param> 348 internal static List<PwgCategory> ConvertProxyResponseToDTO(PwgCategoriesProxyResponse response )348 internal static List<PwgCategory> ConvertProxyResponseToDTO(PwgCategoriesProxyResponse response, Int32? CatgeroryId) 349 349 { 350 350 List<PwgCategory> returnValue = new List<PwgCategory>(); … … 352 352 foreach (PwgCategoryProxyResponse respCat in response.Categories) 353 353 { 354 returnValue.Add(ConvertProxyResponseToDTO(respCat)); 354 if ((!CatgeroryId.HasValue) || (CatgeroryId.Value != respCat.Id)) 355 { 356 returnValue.Add(ConvertProxyResponseToDTO(respCat)); 357 } 355 358 } 356 359 -
extensions/PiwigoLib/PiwigoWpf/App.xaml
r11922 r11935 8 8 <ObjectDataProvider x:Name="ImagesODP" x:Key="Images" ObjectType="{x:Type piwigo:PwgImageListWPF}"/> <!--IsAsynchronous="True"--> 9 9 <ObjectDataProvider x:Name="SessionODP" x:Key="Session" ObjectType="{x:Type piwigo:PwgSessionWPF}" /> 10 <ObjectDataProvider x:Name="CategoriesODP" x:Key="Categories" ObjectType="{x:Type piwigo:Pwg CategoryListWPF}"/> <!--IsAsynchronous="True"-->10 <ObjectDataProvider x:Name="CategoriesODP" x:Key="Categories" ObjectType="{x:Type piwigo:PwgRootCategoryListWPF}"/> <!--IsAsynchronous="True"--> 11 11 <!--IsAsynchronous="True"--> 12 12 <ResourceDictionary x:Key="VisualStyleApp" Source="VisualStyleApp.xaml"/> -
extensions/PiwigoLib/PiwigoWpf/App.xaml.cs
r11911 r11935 3 3 using Com.Piwigo.Lib.IService; 4 4 using Com.Piwigo.Wpf.DTO; 5 using Com.Piwigo.Wpf.DTO.Helper; 5 6 6 7 namespace Com.Piwigo.Wpf … … 15 16 { 16 17 18 PwgModelManager.WPF_SynchronizationContext = System.Threading.SynchronizationContext.Current; 19 17 20 PwgServiceProvider.Instance.PwgSetupService.Setup( "Com.Piwigo.Wpf.PiwigoWPF", null, null); 18 21 19 22 // Model object was created in the app.xaml, so we have to link to them 20 23 PwgModelManager.Instance.Session = (PwgSessionWPF)(this.Resources["Session"] as ObjectDataProvider).Data; 21 PwgModelManager.Instance.CategoryList = (Pwg CategoryListWPF)(this.Resources["Categories"] as ObjectDataProvider).Data;24 PwgModelManager.Instance.CategoryList = (PwgRootCategoryListWPF)(this.Resources["Categories"] as ObjectDataProvider).Data; 22 25 PwgModelManager.Instance.ImageList = (PwgImageListWPF)(this.Resources["Images"] as ObjectDataProvider).Data; 26 //PwgCategoryListWPFHelper.InitRootCategory(); 23 27 24 28 PwgModelManager.Instance.Session.ServeurName = global::Com.Piwigo.Wpf.Properties.Settings.Default.ServerNameData; -
extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdConnect.cs
r11922 r11935 36 36 PwgSessionWPFHelper.AddPwgSessionInfoToPwgSessionWPF(sess, ref sesWPF); 37 37 38 List<PwgCategory> lstCat = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfCategory(null, false, null); //(PwgModelManager.Instance.Session.Status == PwgSessionStatusEnum.Guest) 39 PwgCategoryListWPF lstCatWPF = PwgModelManager.Instance.CategoryList; 38 PwgCategoryListWPFHelper.InitRootCategory(); 40 39 41 PwgCategoryListWPFHelper.ConvertPwgCategoryListToPwgCategoryListWPF(lstCat, ref lstCatWPF); 40 List<PwgCategory> lstCat = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfCategory(null, null, null); //(PwgModelManager.Instance.Session.Status == PwgSessionStatusEnum.Guest) 41 PwgRootCategoryWPF aRootCatWPF = PwgModelManager.Instance.RootCategoryList; 42 43 PwgCategoryListWPFHelper.ConvertPwgCategoryListToPwgRootCategoryWPF(lstCat, ref aRootCatWPF); 44 aRootCatWPF.IsExpanded = true; 42 45 43 46 SendUiInfo("Setting up cache data ..."); -
extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdDisconnect.cs
r11922 r11935 32 32 } 33 33 34 if ((PwgModelManager.Instance.CategoryList != null) 35 && (PwgModelManager.Instance.RootCategoryList != null)) 36 { 37 PwgModelManager.Instance.RootCategoryList.Childrens.Clear(); 38 } 39 34 40 if (PwgModelManager.Instance.CategoryList != null) 35 41 { -
extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdGetImageforCategory.cs
r11922 r11935 28 28 PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList; 29 29 SendUiInfo("Removing image..."); 30 PwgModelManager.Instance.ImageShown = null; 30 31 if (lstImgWPF != null) 31 32 { -
extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdProvider.cs
r11922 r11935 24 24 objICom = PwgCmdGetImageforCategory; 25 25 break; 26 case "PwgCmdGetSubCategorieforCategory": 27 objICom = PwgCmdGetSubCategorieforCategory; 28 break; 26 29 default: 27 objICom = null; 28 break; 30 throw new ArgumentException("AsyncCommand GetByType : Command Type unknow.", "Type"); 29 31 } 30 32 … … 70 72 } 71 73 } 74 75 public static AsyncCommand _pwgCmdGetSubCategorieforCategory; 76 public static AsyncCommand PwgCmdGetSubCategorieforCategory 77 { 78 get 79 { 80 if (_pwgCmdGetSubCategorieforCategory == null) 81 { 82 _pwgCmdGetSubCategorieforCategory = new PwgCmdGetSubCategorieforCategory(); 83 } 84 return _pwgCmdGetSubCategorieforCategory; 85 } 86 } 87 72 88 } 73 89 } -
extensions/PiwigoLib/PiwigoWpf/DTO/AsyncObservableCollection.cs
r11911 r11935 8 8 { 9 9 public class AsyncObservableCollection<T> : ObservableCollection<T> 10 { 11 private SynchronizationContext _synchronizationContext = SynchronizationContext.Current; 10 { 12 11 13 12 public AsyncObservableCollection() … … 22 21 protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) 23 22 { 24 if (SynchronizationContext.Current == _synchronizationContext)23 if (SynchronizationContext.Current == PwgModelManager.WPF_SynchronizationContext) 25 24 { 26 25 // Execute the CollectionChanged event on the current thread … … 30 29 { 31 30 // Send the CollectionChanged event on the creator thread 32 _synchronizationContext.Send(RaiseCollectionChanged, e);31 PwgModelManager.WPF_SynchronizationContext.Send(RaiseCollectionChanged, e); 33 32 } 34 33 } … … 42 41 protected override void OnPropertyChanged(PropertyChangedEventArgs e) 43 42 { 44 if (SynchronizationContext.Current == _synchronizationContext)43 if (SynchronizationContext.Current == PwgModelManager.WPF_SynchronizationContext) 45 44 { 46 45 // Execute the PropertyChanged event on the current thread … … 49 48 else 50 49 { 51 // Postthe PropertyChanged event on the creator thread52 _synchronizationContext.Post(RaisePropertyChanged, e);50 // Send the PropertyChanged event on the creator thread 51 PwgModelManager.WPF_SynchronizationContext.Send(RaisePropertyChanged, e); 53 52 } 54 53 } -
extensions/PiwigoLib/PiwigoWpf/DTO/Helper/PwgCategoryListWPFHelper.cs
r11911 r11935 34 34 aPwgCategoryListWPF = new PwgCategoryListWPF(); 35 35 } 36 36 37 foreach (PwgCategory pwgCat in aPwgCategoryList) 37 38 { … … 40 41 } 41 42 } 43 44 public static void ConvertPwgCategoryListToPwgRootCategoryWPF(List<PwgCategory> aPwgCategoryList, ref PwgRootCategoryWPF aPwgRootCategory) 45 { 46 if (aPwgCategoryList != null) 47 { 48 if ((aPwgRootCategory == null) 49 || (aPwgRootCategory.Childrens == null)) 50 { 51 throw new SystemException("The PwgCategoryListWPFHelper.InitRootCategory must be called before calling this."); 52 } 53 54 if (aPwgRootCategory.Childrens == null) 55 { 56 aPwgRootCategory.Childrens = new PwgCategoryListWPF(); 57 } 58 59 PwgCategoryListWPF aPwgCategoryListWPF = aPwgRootCategory.Childrens; 60 foreach (PwgCategory pwgCat in aPwgCategoryList) 61 { 62 AddPwgCategoryToList(pwgCat, ref aPwgCategoryListWPF); 63 } 64 } 65 } 66 67 public static void InitRootCategory () 68 { 69 if (PwgModelManager.Instance.CategoryList == null) 70 { 71 throw new SystemException("The PwgModelManager.Instance.CategoryList must be initialized from presentation tread before calling this."); 72 } 73 if (PwgModelManager.Instance.CategoryList.Count != 1) 74 { 75 PwgModelManager.Instance.CategoryList.Clear(); 76 PwgRootCategoryWPF aRootCategory = new PwgRootCategoryWPF(); 77 aRootCategory.Name = "Root"; 78 aRootCategory.Childrens = new PwgCategoryListWPF(); 79 PwgModelManager.Instance.CategoryList.Add(aRootCategory); 80 PwgModelManager.Instance.RootCategoryList = aRootCategory; 81 } 82 83 if (PwgModelManager.Instance.RootCategoryList == null) 84 { 85 PwgModelManager.Instance.RootCategoryList = PwgModelManager.Instance.CategoryList.ElementAtOrDefault(0); 86 } 87 88 } 42 89 } 43 90 } -
extensions/PiwigoLib/PiwigoWpf/DTO/PwgCategoryListWPF.cs
r11911 r11935 4 4 using System.Text; 5 5 using System.Collections.ObjectModel; 6 using System.ComponentModel; 6 7 7 8 namespace Com.Piwigo.Wpf.DTO 8 9 { 9 10 public class PwgCategoryListWPF : AsyncObservableCollection<PwgCategoryWPF> 10 { 11 } 11 {} 12 13 public class PwgRootCategoryListWPF : AsyncObservableCollection<PwgRootCategoryWPF> 14 { } 15 12 16 } -
extensions/PiwigoLib/PiwigoWpf/DTO/PwgCategoryWPF.cs
r11926 r11935 9 9 namespace Com.Piwigo.Wpf.DTO 10 10 { 11 12 public class PwgCategoryWPF : INotifyPropertyChanged 11 public abstract class PwgTreeCategoryWPF : INotifyPropertyChanged 13 12 { 14 private Int32 _id; 15 public Int32 Id 13 public abstract Int32 Id 16 14 { 17 set { _id = value; OnPropertyChanged("Id"); } 18 get { return _id; } 19 } 20 21 private ObservableCollection<Int32> _upperCategoriesId; 22 public ObservableCollection<Int32> UpperCategoriesId 23 { 24 set { _upperCategoriesId = value; OnPropertyChanged("UpperCategoriesId"); } 25 get { return _upperCategoriesId; } 15 get; 16 set; 26 17 } 27 18 … … 33 24 } 34 25 35 private Uri _url;36 public Uri Url37 {38 set { _url = value; OnPropertyChanged("Url"); }39 get { return _url; }40 }41 42 private Int64 _imagesCount;43 public Int64 ImagesCount44 {45 set { _imagesCount = value; OnPropertyChanged("ImagesCount"); }46 get { return _imagesCount; }47 }48 49 private Int64 _deepImagesCount;50 public Int64 DeepImagesCount51 {52 set { _deepImagesCount = value; OnPropertyChanged("DeepImagesCount"); }53 get { return _deepImagesCount; }54 }55 56 private Int64 _subCategoriesCount;57 public Int64 SubCategoriesCount58 {59 set { _subCategoriesCount = value; OnPropertyChanged("SubCategoriesCount"); }60 get { return _subCategoriesCount; }61 }62 63 private DateTime _lastDate;64 public DateTime LastDate65 {66 set { _lastDate = value; OnPropertyChanged("LastDate"); }67 get { return _lastDate; }68 }69 70 71 26 public event PropertyChangedEventHandler PropertyChanged; 72 pr ivatevoid OnPropertyChanged(String info)27 protected void OnPropertyChanged(String info) 73 28 { 74 29 if (PropertyChanged != null) 75 30 PropertyChanged(this, new PropertyChangedEventArgs(info)); 76 31 } 77 78 #region Presentation Members79 32 80 33 #region IsExpanded … … 126 79 #endregion // IsSelected 127 80 128 #region Parent 81 #region Parents - Childs 129 82 private PwgCategoryWPF _parent = null; 130 public PwgCategoryWPF Parent83 public abstract PwgCategoryWPF Parent 131 84 { 132 get { return _parent; } 85 get; 86 set; 87 } 88 89 private PwgCategoryListWPF _childrens = null; 90 public PwgCategoryListWPF Childrens 91 { 92 get { return _childrens; } 93 set { _childrens = value; this.OnPropertyChanged("Childrens"); } 133 94 } 134 95 135 96 #endregion // Parent 97 } 136 98 137 #endregion // Presentation Members 99 public class PwgRootCategoryWPF : PwgTreeCategoryWPF 100 { 101 private Int32 _id = Com.Piwigo.Lib.DTO.PwgCategory.RootCategoryId; 102 public override Int32 Id 103 { 104 set { throw new SystemException("Couldn't not set the Id for Root category"); } 105 get { return _id; } 106 } 107 108 private PwgCategoryWPF _parent = null; 109 public override PwgCategoryWPF Parent 110 { 111 get { return _parent; } 112 set { throw new SystemException("Couldn't not set Parent for Root category"); } 113 } 114 } 115 116 public class PwgCategoryWPF : PwgTreeCategoryWPF 117 { 118 private Int32 _id; 119 public override Int32 Id 120 { 121 set { _id = value; OnPropertyChanged("Id"); } 122 get { return _id; } 123 } 124 125 private ObservableCollection<Int32> _upperCategoriesId; 126 public ObservableCollection<Int32> UpperCategoriesId 127 { 128 set { _upperCategoriesId = value; OnPropertyChanged("UpperCategoriesId"); } 129 get { return _upperCategoriesId; } 130 } 131 132 private Uri _url; 133 public Uri Url 134 { 135 set { _url = value; OnPropertyChanged("Url"); } 136 get { return _url; } 137 } 138 139 private Int64 _imagesCount; 140 public Int64 ImagesCount 141 { 142 set { _imagesCount = value; OnPropertyChanged("ImagesCount"); } 143 get { return _imagesCount; } 144 } 145 146 private Int64 _deepImagesCount; 147 public Int64 DeepImagesCount 148 { 149 set { _deepImagesCount = value; OnPropertyChanged("DeepImagesCount"); } 150 get { return _deepImagesCount; } 151 } 152 153 private Int64 _subCategoriesCount; 154 public Int64 SubCategoriesCount 155 { 156 set { _subCategoriesCount = value; OnPropertyChanged("SubCategoriesCount"); } 157 get { return _subCategoriesCount; } 158 } 159 160 private DateTime _lastDate; 161 public DateTime LastDate 162 { 163 set { _lastDate = value; OnPropertyChanged("LastDate"); } 164 get { return _lastDate; } 165 } 166 167 #region Presentation Members 168 169 #region Parents - Childs 170 private PwgCategoryWPF _parent = null; 171 public override PwgCategoryWPF Parent 172 { 173 set { _parent = value; OnPropertyChanged("Parent"); } 174 get { return _parent; } 175 } 176 #endregion // Parents - Childs 177 #endregion // Presentation Members 138 178 } 139 179 } -
extensions/PiwigoLib/PiwigoWpf/DTO/PwgModelManager.cs
r11926 r11935 9 9 public sealed class PwgModelManager 10 10 { 11 private static System.Threading.SynchronizationContext _synchronizationContext = System.Threading.SynchronizationContext.Current; 12 13 public static System.Threading.SynchronizationContext WPF_SynchronizationContext 14 { 15 get { 16 return _synchronizationContext; 17 } 18 set { 19 _synchronizationContext = value; 20 } 21 } 22 11 23 static readonly PwgModelManagerBase _instance = new PwgModelManagerBase(); 12 24 … … 55 67 } 56 68 57 private Pwg CategoryListWPF _categoryList;58 public Pwg CategoryListWPF CategoryList69 private PwgRootCategoryListWPF _categoryList = new PwgRootCategoryListWPF(); 70 public PwgRootCategoryListWPF CategoryList 59 71 { 60 72 set { _categoryList = value; OnPropertyChanged("CategoryList"); } 61 73 get { return _categoryList; } 62 74 } 75 76 private PwgRootCategoryWPF _rootCategoryList; 77 public PwgRootCategoryWPF RootCategoryList 78 { 79 set { _rootCategoryList = value; OnPropertyChanged("RootCategoryList"); } 80 get { return _rootCategoryList; } 81 } 82 63 83 64 84 private PwgImageWPF _imageShown; -
extensions/PiwigoLib/PiwigoWpf/Helper/AppHelper.cs
r11922 r11935 55 55 { 56 56 AsyncCommand cmd = PwgCmdProvider.GetByType<T>(); 57 if (cmd .CanExecute(parameter))57 if (cmd != null) 58 58 { 59 cmd.Execute(parameter); 59 if (cmd.CanExecute(parameter)) 60 { 61 cmd.Execute(parameter); 62 } 60 63 } 61 64 } -
extensions/PiwigoLib/PiwigoWpf/MainWindow.xaml
r11926 r11935 9 9 xmlns:pwghlp="clr-namespace:Com.Piwigo.Wpf.Helper" 10 10 Title="PiwigoWpf" 11 Name="_this" 11 12 WindowState="Maximized" 12 MinHeight="600" MinWidth="800" >13 MinHeight="600" MinWidth="800" Background="AliceBlue"> 13 14 <Window.Resources> 14 15 <pwghlp:AdvBooltoVisibilityConverter x:Key="AdvBooltoVisibilityConverter" Collapse="False" Reverse="False" /> 15 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> 16 84 </Window.Resources> 17 85 <Grid> 18 86 <Grid.ColumnDefinitions > 19 <ColumnDefinition Width=" *"/>87 <ColumnDefinition Width="Auto"/> 20 88 <ColumnDefinition Width="Auto"/> 21 89 <ColumnDefinition Width="*" MinWidth="600"/> 22 90 </Grid.ColumnDefinitions> 23 91 <Grid.RowDefinitions> 24 <RowDefinition Height="Auto" />25 <RowDefinition Height="*" />26 92 <RowDefinition Height="Auto" /> 27 93 <RowDefinition Height="*" /> … … 37 103 Source="pack://application:,,,/Pictures/PiwigoLogo.png" 38 104 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}}"105 <Grid Name="OverLay" Visibility="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=booCmdRunning, Converter={StaticResource AdvBooltoVisibilityConverter}}"> 106 <Image Name="ImgGlobe" Margin="2" 41 107 Source="pack://application:,,,/Pictures/128x128/Globe.png" 42 ToolTip="www.piwigo.org" Stretch="None" HorizontalAlignment="Right"/> 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> 43 113 <UniformGrid Name="SessInfo" Margin="10" DataContext="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=Session}" Columns="2" Rows="5"> 44 114 <Label Content="Status"/> … … 68 138 </StackPanel> 69 139 </StackPanel> 70 <TreeView Name="listViewCategory" 140 <TreeView Name="listViewCategory" Background="{Binding ElementName=this}" 71 141 Grid.Column="0" 72 142 Grid.Row="1" 73 Grid.RowSpan="3" 74 MinWidth="100" 143 MinWidth="180" 75 144 DataContext="{Binding Source={StaticResource Categories}}" 76 ItemsSource="{Binding }" MouseDoubleClick="listViewCategory_MouseDoubleClick"> 145 ItemsSource="{Binding}" MouseDoubleClick="listViewCategory_MouseDoubleClick" 146 HorizontalAlignment="Left" PreviewMouseDown="listViewCategory_PreviewMouseDown"> 77 147 <TreeView.ItemContainerStyle> 78 148 <!-- … … 116 186 <TreeView.Resources> 117 187 <HierarchicalDataTemplate 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 118 200 DataType="{x:Type pwgdto:PwgCategoryWPF}" 119 ItemsSource="{Binding Children }"201 ItemsSource="{Binding Childrens}" 120 202 > 121 203 <StackPanel Orientation="Horizontal" DataContext="{Binding}" … … 123 205 <Image Source="pack://application:,,,/Pictures/22x22/folder_images.png" Margin="5" 124 206 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 207 </Image> 138 208 <TextBlock Text="{Binding Name}" /> 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> 139 217 </StackPanel> 140 218 </HierarchicalDataTemplate> 141 219 </TreeView.Resources> 142 220 </TreeView> 143 <GridSplitter 221 <GridSplitter ResizeDirection="Columns" 144 222 Grid.Column="1" 145 223 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" 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" 151 239 MinWidth="500" 152 240 DataContext="{Binding Source={StaticResource Images}}" 153 241 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 <DoubleAnimation242 <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 172 260 Duration="0:0:0.2" 173 261 Storyboard.TargetProperty="Opacity" 174 262 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 <DoubleAnimation263 </Storyboard> 264 </BeginStoryboard> 265 </EventTrigger.Actions> 266 </EventTrigger> 267 <EventTrigger RoutedEvent="Mouse.MouseLeave"> 268 <EventTrigger.Actions> 269 <BeginStoryboard> 270 <Storyboard> 271 <DoubleAnimation 184 272 Duration="0:0:0.2" 185 273 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"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" 199 287 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> 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> 224 316 <Expander 225 317 Grid.Column="0" 226 318 Grid.ColumnSpan="3" 227 Grid.Row=" 4" >319 Grid.Row="3" > 228 320 <Expander.Header> 229 321 <Button Height="18" Name="btnDeleteLog" Width="18" -
extensions/PiwigoLib/PiwigoWpf/MainWindow.xaml.cs
r11926 r11935 14 14 using Com.Piwigo.Wpf.Helper; 15 15 using Com.Piwigo.Wpf.Command; 16 using Com.Piwigo.Wpf.DTO; 16 17 17 18 namespace Com.Piwigo.Wpf … … 42 43 } 43 44 45 private void listViewCategory_PreviewMouseDown(object sender, MouseButtonEventArgs e) 46 { 47 e.Handled = false; 48 DependencyObject dep = (DependencyObject)e.OriginalSource; 49 while ((dep != null) && !(dep is TreeViewItem)) 50 { 51 dep = VisualTreeHelper.GetParent(dep); 52 } 53 if (dep != null) 54 { 55 if (((TreeViewItem)dep).DataContext is PwgCategoryWPF) 56 { 57 PwgCategoryWPF aCat = (PwgCategoryWPF)((TreeViewItem)dep).DataContext; 58 59 if ((e.ChangedButton == MouseButton.Left) && (e.ClickCount == 1)) 60 { 61 // left single click event 62 if (aCat.Childrens == null) 63 { 64 AppHelper.ExecuteCommand<PwgCmdGetSubCategorieforCategory>(aCat); 65 } 66 } 67 } 68 } 69 } 70 44 71 45 72 } -
extensions/PiwigoLib/PiwigoWpf/PiwigoWpf.csproj
r11926 r11935 77 77 <SubType>Designer</SubType> 78 78 </ApplicationDefinition> 79 <Compile Include="Command\PwgCmdGetSubCategorieforCategory.cs" /> 79 80 <Compile Include="Command\PwgCmdSelectImageInCategory.cs" /> 80 81 <Compile Include="Command\DelegateCommand.cs" />
Note: See TracChangeset
for help on using the changeset viewer.