Changeset 11905


Ignore:
Timestamp:
Aug 4, 2011, 5:34:52 PM (13 years ago)
Author:
bayral
Message:

firsts steps of wpf client

Location:
extensions/PiwigoLib/PiwigoWpf
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/PiwigoLib/PiwigoWpf/App.xaml

    r11904 r11905  
    66             Exit="onAppExit">
    77    <Application.Resources>
    8         <ObjectDataProvider x:Name="ImagesODP" x:Key="Images" IsAsynchronous="True" ObjectType="{x:Type piwigo:PwgImageListWPF}" />
     8        <ObjectDataProvider x:Name="ImagesODP" x:Key="Images" ObjectType="{x:Type piwigo:PwgImageListWPF}" />
    99        <ObjectDataProvider x:Name="SessionODP" x:Key="Session" ObjectType="{x:Type piwigo:PwgSessionWPF}" />
    10         <ObjectDataProvider x:Name="CategoriesODP" x:Key="Categories" IsAsynchronous="True" ObjectType="{x:Type piwigo:PwgCategoryListWPF}" />
     10        <ObjectDataProvider x:Name="CategoriesODP" x:Key="Categories" ObjectType="{x:Type piwigo:PwgCategoryListWPF}" />
    1111       
    1212        <ResourceDictionary  x:Key="VisualStyleApp" Source="VisualStyleApp.xaml"/>
  • extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdBase.cs

    r11904 r11905  
    44using System.Text;
    55using System.Windows.Input;
     6using Com.Piwigo.Wpf.Helper;
     7using Com.Piwigo.Wpf.DTO;
    68
    79namespace Com.Piwigo.Wpf.Command
    810{
    9     public abstract class PwgCmdBase :  ICommand
     11    public abstract class PwgCmdBase : ICommand
    1012    {
     13       Boolean _isRunning;
     14       public Boolean IsRunning {
     15           get
     16           {
     17               return _isRunning;
     18           }
     19           set
     20           {
     21               _isRunning = value;
     22           }
     23       }
    1124
    1225       #region ICommand Membres
     26        public virtual bool CanExecute(object parameter)
     27        {
     28             Boolean retVal = false;
     29            if ( AppHelper.IsInDesignModeStatic == true)
     30            {
     31                retVal = false;
     32            }
     33            else
     34            {
     35                if (IsRunning)
     36                {
     37                    retVal = false;
     38                }
     39                else if (PwgModelManager.Instance.Session != null)
     40                {
     41                    retVal = !String.IsNullOrWhiteSpace(PwgModelManager.Instance.Session.ServeurName);                   
     42                }
     43            }
     44            return (retVal);
     45        }
    1346
    14        public abstract  bool CanExecute(object parameter);
    15 
    16        public abstract void Execute(object parameter);
     47        public abstract void Execute(object parameter);
    1748       
    1849        public event EventHandler CanExecuteChanged
    19        {
     50        {
    2051           add { CommandManager.RequerySuggested += value; }
    2152           remove { CommandManager.RequerySuggested -= value; }
    22        }
     53        }
    2354       #endregion
    2455    }
  • extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdConnect.cs

    r11904 r11905  
    1212    public sealed class PwgCmdConnect : PwgCmdBase
    1313    {
    14         public override bool CanExecute(object parameter)
    15         {
    16             Boolean retVal = false;
    17             if ( AppHelper.IsInDesignModeStatic == true)
    18             {
    19                 retVal = false;
    20             }
    21             else
    22             {
    23                 if ((PwgModelManager.Instance.Session != null)
    24                     & (PwgModelManager.Instance.Session.ServeurName != null))
    25                 {
    26                     retVal = !String.IsNullOrWhiteSpace(PwgModelManager.Instance.Session.ServeurName);
    27                 }
    28             }
    29             return (retVal);
    30         }
    31 
    3214        public override void Execute(object parameter)
    3315        {
    3416            try {
     17                IsRunning = true;
    3518                Uri uriServer = new Uri(PwgModelManager.Instance.Session.ServeurName);
    3619
     
    4326                PwgSessionWPFHelper.AddPwgSessionInfoToPwgSessionWPF(sess, ref sesWPF);
    4427
    45                 List<PwgCategory> lstCat = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfCategory(null, false, (PwgModelManager.Instance.Session.Status == PwgSessionStatusEnum.Guest));
     28                List<PwgCategory> lstCat = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfCategory(null, false, null); //(PwgModelManager.Instance.Session.Status == PwgSessionStatusEnum.Guest)
    4629                PwgCategoryListWPF lstCatWPF = PwgModelManager.Instance.CategoryList;
    4730
     
    4932
    5033                ImageCacheManager.Instance.SetCurrentServer(uriServer.AbsoluteUri);
     34                IsRunning = false;
    5135            }
    5236            catch (PwgServiceException ex)
  • extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdGetImageforCategory.cs

    r11904 r11905  
    1212    public sealed class PwgCmdGetImageforCategory : PwgCmdBase
    1313    {
    14         public override bool CanExecute(object parameter)
    15         {
    16             Boolean retVal = false;
    17             if ( AppHelper.IsInDesignModeStatic == true)
    18             {
    19                 retVal = false;
    20             }
    21             else
    22             {
    23                 if ((PwgModelManager.Instance.Session != null)
    24                     & (PwgModelManager.Instance.Session.ServeurName != null))
    25                 {
    26                     retVal = !String.IsNullOrWhiteSpace(PwgModelManager.Instance.Session.ServeurName);
    27                 }
    28             }
    29             return (retVal);
    30         }
    31 
    3214        public override void Execute(object parameter)
    3315        {
  • extensions/PiwigoLib/PiwigoWpf/DTO/PwgModelManager.cs

    r11904 r11905  
    33using System.Linq;
    44using System.Text;
     5using System.ComponentModel;
    56
    67namespace Com.Piwigo.Wpf.DTO
     
    2627        public class PwgModelManagerBase
    2728        {
    28             public PwgImageListWPF ImageList { get; set; }
    29             public PwgSessionWPF Session { get; set; }
    30             public PwgCategoryListWPF CategoryList { get; set; }
     29            private PwgImageListWPF _imageList;
     30            public PwgImageListWPF ImageList
     31            {
     32                set { _imageList = value; OnPropertyChanged("ImageList"); }
     33                get { return _imageList; }
     34            }
     35
     36            private PwgSessionWPF _session;
     37            public PwgSessionWPF Session
     38            {
     39                set { _session = value; OnPropertyChanged("Session"); }
     40                get { return _session; }
     41            }
     42
     43            private PwgCategoryListWPF _categoryList;
     44            public PwgCategoryListWPF CategoryList
     45            {
     46                set { _categoryList = value; OnPropertyChanged("CategoryList"); }
     47                get { return _categoryList; }
     48            }
     49
     50            public event PropertyChangedEventHandler PropertyChanged;
     51            private void OnPropertyChanged(String info)
     52            {
     53                if (PropertyChanged != null)
     54                    PropertyChanged(this, new PropertyChangedEventArgs(info));
     55            }
    3156        }
    3257
     58       
    3359    }
    3460}
Note: See TracChangeset for help on using the changeset viewer.