Changeset 11905
- Timestamp:
- Aug 4, 2011, 5:34:52 PM (13 years ago)
- Location:
- extensions/PiwigoLib/PiwigoWpf
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PiwigoLib/PiwigoWpf/App.xaml
r11904 r11905 6 6 Exit="onAppExit"> 7 7 <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}" /> 9 9 <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}" /> 11 11 12 12 <ResourceDictionary x:Key="VisualStyleApp" Source="VisualStyleApp.xaml"/> -
extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdBase.cs
r11904 r11905 4 4 using System.Text; 5 5 using System.Windows.Input; 6 using Com.Piwigo.Wpf.Helper; 7 using Com.Piwigo.Wpf.DTO; 6 8 7 9 namespace Com.Piwigo.Wpf.Command 8 10 { 9 public abstract class PwgCmdBase : 11 public abstract class PwgCmdBase : ICommand 10 12 { 13 Boolean _isRunning; 14 public Boolean IsRunning { 15 get 16 { 17 return _isRunning; 18 } 19 set 20 { 21 _isRunning = value; 22 } 23 } 11 24 12 25 #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 } 13 46 14 public abstract bool CanExecute(object parameter); 15 16 public abstract void Execute(object parameter); 47 public abstract void Execute(object parameter); 17 48 18 49 public event EventHandler CanExecuteChanged 19 {50 { 20 51 add { CommandManager.RequerySuggested += value; } 21 52 remove { CommandManager.RequerySuggested -= value; } 22 }53 } 23 54 #endregion 24 55 } -
extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdConnect.cs
r11904 r11905 12 12 public sealed class PwgCmdConnect : PwgCmdBase 13 13 { 14 public override bool CanExecute(object parameter)15 {16 Boolean retVal = false;17 if ( AppHelper.IsInDesignModeStatic == true)18 {19 retVal = false;20 }21 else22 {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 32 14 public override void Execute(object parameter) 33 15 { 34 16 try { 17 IsRunning = true; 35 18 Uri uriServer = new Uri(PwgModelManager.Instance.Session.ServeurName); 36 19 … … 43 26 PwgSessionWPFHelper.AddPwgSessionInfoToPwgSessionWPF(sess, ref sesWPF); 44 27 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) 46 29 PwgCategoryListWPF lstCatWPF = PwgModelManager.Instance.CategoryList; 47 30 … … 49 32 50 33 ImageCacheManager.Instance.SetCurrentServer(uriServer.AbsoluteUri); 34 IsRunning = false; 51 35 } 52 36 catch (PwgServiceException ex) -
extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdGetImageforCategory.cs
r11904 r11905 12 12 public sealed class PwgCmdGetImageforCategory : PwgCmdBase 13 13 { 14 public override bool CanExecute(object parameter)15 {16 Boolean retVal = false;17 if ( AppHelper.IsInDesignModeStatic == true)18 {19 retVal = false;20 }21 else22 {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 32 14 public override void Execute(object parameter) 33 15 { -
extensions/PiwigoLib/PiwigoWpf/DTO/PwgModelManager.cs
r11904 r11905 3 3 using System.Linq; 4 4 using System.Text; 5 using System.ComponentModel; 5 6 6 7 namespace Com.Piwigo.Wpf.DTO … … 26 27 public class PwgModelManagerBase 27 28 { 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 } 31 56 } 32 57 58 33 59 } 34 60 }
Note: See TracChangeset
for help on using the changeset viewer.