Changeset 11935


Ignore:
Timestamp:
Aug 12, 2011, 4:32:33 PM (13 years ago)
Author:
bayral
Message:

root category handled

Location:
extensions/PiwigoLib
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • extensions/PiwigoLib/PiwigoLib/Service/PwgCategoriesService.cs

    r11850 r11935  
    4242                else
    4343                {
    44                     returnValue = ConvertProxyResponseToDTO(response);
     44                    returnValue = ConvertProxyResponseToDTO(response, CatgeroryId);
    4545                }
    4646            }
     
    7979                else
    8080                {
    81                     returnValue = ConvertProxyResponseToDTO(response);
     81                    returnValue = ConvertProxyResponseToDTO(response, null);
    8282                }
    8383            }
     
    346346        /// <param name="response"></param>
    347347        /// <param name="session"></param>
    348         internal static List<PwgCategory> ConvertProxyResponseToDTO(PwgCategoriesProxyResponse response)
     348        internal static List<PwgCategory> ConvertProxyResponseToDTO(PwgCategoriesProxyResponse response, Int32? CatgeroryId)
    349349        {
    350350            List<PwgCategory> returnValue = new List<PwgCategory>();
     
    352352            foreach (PwgCategoryProxyResponse respCat in response.Categories)
    353353            {
    354                 returnValue.Add(ConvertProxyResponseToDTO(respCat));
     354                if ((!CatgeroryId.HasValue) || (CatgeroryId.Value != respCat.Id))
     355                {
     356                    returnValue.Add(ConvertProxyResponseToDTO(respCat));
     357                }
    355358            }
    356359
  • extensions/PiwigoLib/PiwigoWpf/App.xaml

    r11922 r11935  
    88        <ObjectDataProvider x:Name="ImagesODP" x:Key="Images" ObjectType="{x:Type piwigo:PwgImageListWPF}"/> <!--IsAsynchronous="True"-->
    99        <ObjectDataProvider x:Name="SessionODP" x:Key="Session" ObjectType="{x:Type piwigo:PwgSessionWPF}" />
    10         <ObjectDataProvider x:Name="CategoriesODP" x:Key="Categories" ObjectType="{x:Type piwigo:PwgCategoryListWPF}"/> <!--IsAsynchronous="True"-->
     10        <ObjectDataProvider x:Name="CategoriesODP" x:Key="Categories" ObjectType="{x:Type piwigo:PwgRootCategoryListWPF}"/> <!--IsAsynchronous="True"-->
    1111        <!--IsAsynchronous="True"-->
    1212        <ResourceDictionary  x:Key="VisualStyleApp" Source="VisualStyleApp.xaml"/>
  • extensions/PiwigoLib/PiwigoWpf/App.xaml.cs

    r11911 r11935  
    33using Com.Piwigo.Lib.IService;
    44using Com.Piwigo.Wpf.DTO;
     5using Com.Piwigo.Wpf.DTO.Helper;
    56
    67namespace Com.Piwigo.Wpf
     
    1516        {
    1617
     18            PwgModelManager.WPF_SynchronizationContext = System.Threading.SynchronizationContext.Current;
     19
    1720            PwgServiceProvider.Instance.PwgSetupService.Setup( "Com.Piwigo.Wpf.PiwigoWPF", null, null);
    1821
    1922             // Model object was created in the app.xaml, so we have to link to them
    2023            PwgModelManager.Instance.Session = (PwgSessionWPF)(this.Resources["Session"] as ObjectDataProvider).Data;
    21             PwgModelManager.Instance.CategoryList = (PwgCategoryListWPF)(this.Resources["Categories"] as ObjectDataProvider).Data;
     24            PwgModelManager.Instance.CategoryList = (PwgRootCategoryListWPF)(this.Resources["Categories"] as ObjectDataProvider).Data;
    2225            PwgModelManager.Instance.ImageList = (PwgImageListWPF)(this.Resources["Images"] as ObjectDataProvider).Data;
     26            //PwgCategoryListWPFHelper.InitRootCategory();
    2327
    2428            PwgModelManager.Instance.Session.ServeurName = global::Com.Piwigo.Wpf.Properties.Settings.Default.ServerNameData;
  • extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdConnect.cs

    r11922 r11935  
    3636                PwgSessionWPFHelper.AddPwgSessionInfoToPwgSessionWPF(sess, ref sesWPF);
    3737
    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();
    4039
    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;
    4245
    4346                SendUiInfo("Setting up cache data ...");
  • extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdDisconnect.cs

    r11922 r11935  
    3232                }
    3333
     34                if ((PwgModelManager.Instance.CategoryList != null)
     35                    && (PwgModelManager.Instance.RootCategoryList != null))
     36                {
     37                    PwgModelManager.Instance.RootCategoryList.Childrens.Clear();
     38                }
     39
    3440                if (PwgModelManager.Instance.CategoryList != null)
    3541                {
  • extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdGetImageforCategory.cs

    r11922 r11935  
    2828                    PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList;
    2929                    SendUiInfo("Removing image...");
     30                    PwgModelManager.Instance.ImageShown = null;
    3031                    if (lstImgWPF != null)
    3132                    {
  • extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdProvider.cs

    r11922 r11935  
    2424                    objICom = PwgCmdGetImageforCategory;
    2525                    break;
     26                case "PwgCmdGetSubCategorieforCategory":
     27                    objICom = PwgCmdGetSubCategorieforCategory;
     28                    break;
    2629                default:
    27                     objICom = null;
    28                     break;
     30                    throw new ArgumentException("AsyncCommand GetByType : Command Type unknow.", "Type");
    2931            }
    3032
     
    7072            }
    7173        }
     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
    7288    }
    7389}
  • extensions/PiwigoLib/PiwigoWpf/DTO/AsyncObservableCollection.cs

    r11911 r11935  
    88{
    99    public class AsyncObservableCollection<T> : ObservableCollection<T>
    10     {
    11         private SynchronizationContext _synchronizationContext = SynchronizationContext.Current;
     10    {       
    1211
    1312        public AsyncObservableCollection()
     
    2221        protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
    2322        {
    24             if (SynchronizationContext.Current == _synchronizationContext)
     23            if (SynchronizationContext.Current == PwgModelManager.WPF_SynchronizationContext)
    2524            {
    2625                // Execute the CollectionChanged event on the current thread
     
    3029            {
    3130                // Send the CollectionChanged event on the creator thread
    32                 _synchronizationContext.Send(RaiseCollectionChanged, e);
     31                PwgModelManager.WPF_SynchronizationContext.Send(RaiseCollectionChanged, e);
    3332            }
    3433        }
     
    4241        protected override void OnPropertyChanged(PropertyChangedEventArgs e)
    4342        {
    44             if (SynchronizationContext.Current == _synchronizationContext)
     43            if (SynchronizationContext.Current == PwgModelManager.WPF_SynchronizationContext)
    4544            {
    4645                // Execute the PropertyChanged event on the current thread
     
    4948            else
    5049            {
    51                 // Post the PropertyChanged event on the creator thread
    52                 _synchronizationContext.Post(RaisePropertyChanged, e);
     50                // Send the PropertyChanged event on the creator thread
     51                PwgModelManager.WPF_SynchronizationContext.Send(RaisePropertyChanged, e);
    5352            }
    5453        }
  • extensions/PiwigoLib/PiwigoWpf/DTO/Helper/PwgCategoryListWPFHelper.cs

    r11911 r11935  
    3434                    aPwgCategoryListWPF = new PwgCategoryListWPF();
    3535                }
     36
    3637                foreach (PwgCategory pwgCat in aPwgCategoryList)
    3738                {
     
    4041            }
    4142        }
     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          }
    4289    }
    4390}
  • extensions/PiwigoLib/PiwigoWpf/DTO/PwgCategoryListWPF.cs

    r11911 r11935  
    44using System.Text;
    55using System.Collections.ObjectModel;
     6using System.ComponentModel;
    67
    78namespace Com.Piwigo.Wpf.DTO
    89{
    910    public class PwgCategoryListWPF : AsyncObservableCollection<PwgCategoryWPF>
    10     {
    11     }
     11    {}
     12
     13    public class PwgRootCategoryListWPF : AsyncObservableCollection<PwgRootCategoryWPF>
     14    { }
     15
    1216}
  • extensions/PiwigoLib/PiwigoWpf/DTO/PwgCategoryWPF.cs

    r11926 r11935  
    99namespace Com.Piwigo.Wpf.DTO
    1010{
    11 
    12     public class PwgCategoryWPF : INotifyPropertyChanged
     11    public abstract class PwgTreeCategoryWPF : INotifyPropertyChanged
    1312    {
    14         private Int32 _id;
    15         public Int32 Id
     13        public abstract Int32 Id
    1614        {
    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;
    2617        }
    2718
     
    3324        }
    3425
    35         private Uri _url;
    36         public Uri Url
    37         {
    38             set { _url = value; OnPropertyChanged("Url"); }
    39             get { return _url; }
    40         }
    41 
    42         private Int64 _imagesCount;
    43         public Int64 ImagesCount
    44         {
    45             set { _imagesCount = value; OnPropertyChanged("ImagesCount"); }
    46             get { return _imagesCount; }
    47         }
    48 
    49         private Int64 _deepImagesCount;
    50         public Int64 DeepImagesCount
    51         {
    52             set { _deepImagesCount = value; OnPropertyChanged("DeepImagesCount"); }
    53             get { return _deepImagesCount; }
    54         }
    55 
    56         private Int64 _subCategoriesCount;
    57         public Int64 SubCategoriesCount
    58         {
    59             set { _subCategoriesCount = value; OnPropertyChanged("SubCategoriesCount"); }
    60             get { return _subCategoriesCount; }
    61         }
    62 
    63         private DateTime _lastDate;
    64         public  DateTime LastDate
    65         {
    66             set { _lastDate = value; OnPropertyChanged("LastDate"); }
    67             get { return _lastDate; }
    68         }
    69 
    70 
    7126        public event PropertyChangedEventHandler PropertyChanged;
    72         private void OnPropertyChanged(String info)
     27        protected void OnPropertyChanged(String info)
    7328        {
    7429            if (PropertyChanged != null)
    7530                PropertyChanged(this, new PropertyChangedEventArgs(info));
    7631        }
    77 
    78         #region Presentation Members
    7932
    8033        #region IsExpanded
     
    12679        #endregion // IsSelected
    12780
    128         #region Parent
     81        #region Parents - Childs
    12982        private PwgCategoryWPF _parent = null;
    130         public PwgCategoryWPF Parent
     83        public abstract PwgCategoryWPF Parent
    13184        {
    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"); }
    13394        }
    13495
    13596        #endregion // Parent
     97    }
    13698
    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
    138178    }
    139179}
  • extensions/PiwigoLib/PiwigoWpf/DTO/PwgModelManager.cs

    r11926 r11935  
    99    public sealed class PwgModelManager
    1010    {
     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
    1123        static readonly PwgModelManagerBase _instance = new PwgModelManagerBase();
    1224
     
    5567            }
    5668
    57             private PwgCategoryListWPF _categoryList;
    58             public PwgCategoryListWPF CategoryList
     69            private PwgRootCategoryListWPF _categoryList = new PwgRootCategoryListWPF();
     70            public PwgRootCategoryListWPF CategoryList
    5971            {
    6072                set { _categoryList = value; OnPropertyChanged("CategoryList"); }
    6173                get { return _categoryList; }
    6274            }
     75
     76            private PwgRootCategoryWPF _rootCategoryList;
     77            public PwgRootCategoryWPF RootCategoryList
     78            {
     79                set { _rootCategoryList = value; OnPropertyChanged("RootCategoryList"); }
     80                get { return _rootCategoryList; }
     81            }
     82
    6383
    6484            private PwgImageWPF _imageShown;
  • extensions/PiwigoLib/PiwigoWpf/Helper/AppHelper.cs

    r11922 r11935  
    5555        {
    5656            AsyncCommand cmd = PwgCmdProvider.GetByType<T>();
    57             if (cmd.CanExecute(parameter))
     57            if (cmd != null)
    5858            {
    59                 cmd.Execute(parameter);
     59                if (cmd.CanExecute(parameter))
     60                {
     61                    cmd.Execute(parameter);
     62                }
    6063            }
    6164        }
  • extensions/PiwigoLib/PiwigoWpf/MainWindow.xaml

    r11926 r11935  
    99        xmlns:pwghlp="clr-namespace:Com.Piwigo.Wpf.Helper"
    1010        Title="PiwigoWpf"
     11        Name="_this"
    1112        WindowState="Maximized"
    12         MinHeight="600" MinWidth="800">
     13        MinHeight="600" MinWidth="800" Background="AliceBlue">
    1314    <Window.Resources>
    1415        <pwghlp:AdvBooltoVisibilityConverter x:Key="AdvBooltoVisibilityConverter"  Collapse="False" Reverse="False" />
    1516        <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>
    1684    </Window.Resources>
    1785    <Grid>
    1886        <Grid.ColumnDefinitions >
    19             <ColumnDefinition Width="*"/>
     87            <ColumnDefinition Width="Auto"/>
    2088            <ColumnDefinition Width="Auto"/>
    2189            <ColumnDefinition Width="*" MinWidth="600"/>
    2290        </Grid.ColumnDefinitions>
    2391        <Grid.RowDefinitions>
    24             <RowDefinition Height="Auto" />
    25             <RowDefinition Height="*" />
    2692            <RowDefinition Height="Auto" />
    2793            <RowDefinition Height="*" />
     
    37103                   Source="pack://application:,,,/Pictures/PiwigoLogo.png"
    38104                   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"                   
    41107                   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>
    43113                <UniformGrid  Name="SessInfo" Margin="10" DataContext="{Binding Source={x:Static pwgdto:PwgModelManager.Instance}, Path=Session}" Columns="2" Rows="5">
    44114                    <Label Content="Status"/>
     
    68138            </StackPanel>
    69139        </StackPanel>
    70         <TreeView Name="listViewCategory" 
     140        <TreeView Name="listViewCategory"  Background="{Binding ElementName=this}"
    71141                Grid.Column="0"
    72142                Grid.Row="1" 
    73                 Grid.RowSpan="3"
    74                 MinWidth="100"
     143                MinWidth="180"
    75144                DataContext="{Binding Source={StaticResource Categories}}"
    76                 ItemsSource="{Binding }" MouseDoubleClick="listViewCategory_MouseDoubleClick">
     145                ItemsSource="{Binding}"  MouseDoubleClick="listViewCategory_MouseDoubleClick"
     146                HorizontalAlignment="Left" PreviewMouseDown="listViewCategory_PreviewMouseDown">
    77147            <TreeView.ItemContainerStyle>
    78148                <!--
     
    116186            <TreeView.Resources>
    117187                <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
    118200                DataType="{x:Type pwgdto:PwgCategoryWPF}"
    119                 ItemsSource="{Binding Children}"
     201                ItemsSource="{Binding Childrens}"
    120202                >
    121203                    <StackPanel Orientation="Horizontal" DataContext="{Binding}"
     
    123205                        <Image Source="pack://application:,,,/Pictures/22x22/folder_images.png" Margin="5"
    124206                        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>
    137207                        </Image>
    138208                        <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>
    139217                    </StackPanel>
    140218                </HierarchicalDataTemplate>
    141219            </TreeView.Resources>
    142220        </TreeView>
    143         <GridSplitter   ResizeDirection="Columns"
     221        <GridSplitter ResizeDirection="Columns"
    144222                    Grid.Column="1"
    145223                    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"   
    151239            MinWidth="500"
    152240            DataContext="{Binding Source={StaticResource Images}}"
    153241            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
     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
    172260                                                                        Duration="0:0:0.2"
    173261                                                                        Storyboard.TargetProperty="Opacity"
    174262                                                                        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
     263                                        </Storyboard>
     264                                    </BeginStoryboard>
     265                                </EventTrigger.Actions>
     266                            </EventTrigger>
     267                            <EventTrigger RoutedEvent="Mouse.MouseLeave">
     268                                <EventTrigger.Actions>
     269                                    <BeginStoryboard>
     270                                        <Storyboard>
     271                                            <DoubleAnimation
    184272                                                                        Duration="0:0:0.2"
    185273                                                                        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"
    199287                    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>
    224316        <Expander 
    225317            Grid.Column="0"
    226318            Grid.ColumnSpan="3"
    227             Grid.Row="4"  >
     319            Grid.Row="3"  >
    228320            <Expander.Header>
    229321                <Button Height="18" Name="btnDeleteLog" Width="18"
  • extensions/PiwigoLib/PiwigoWpf/MainWindow.xaml.cs

    r11926 r11935  
    1414using Com.Piwigo.Wpf.Helper;
    1515using Com.Piwigo.Wpf.Command;
     16using Com.Piwigo.Wpf.DTO;
    1617
    1718namespace Com.Piwigo.Wpf
     
    4243        }
    4344
     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
    4471
    4572    }
  • extensions/PiwigoLib/PiwigoWpf/PiwigoWpf.csproj

    r11926 r11935  
    7777      <SubType>Designer</SubType>
    7878    </ApplicationDefinition>
     79    <Compile Include="Command\PwgCmdGetSubCategorieforCategory.cs" />
    7980    <Compile Include="Command\PwgCmdSelectImageInCategory.cs" />
    8081    <Compile Include="Command\DelegateCommand.cs" />
Note: See TracChangeset for help on using the changeset viewer.